summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-12-24 08:23:25 -0800
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-24 14:29:52 -0800
commit831242f32a3693b3105a517163fba2784d8662af (patch)
tree31f4d5ac3e5ba548556245c470810a5fd881655a
parent81c98502f3f362036c9a4e48ffc1c541520a3f9b (diff)
downloadserenity-831242f32a3693b3105a517163fba2784d8662af.zip
env: Convert to `serenity_main(..)`
-rw-r--r--Userland/Utilities/CMakeLists.txt1
-rw-r--r--Userland/Utilities/env.cpp11
2 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt
index 8916ec32b0..335eb5b220 100644
--- a/Userland/Utilities/CMakeLists.txt
+++ b/Userland/Utilities/CMakeLists.txt
@@ -86,6 +86,7 @@ target_link_libraries(dirname LibMain)
target_link_libraries(disasm LibX86)
target_link_libraries(dmesg LibMain)
target_link_libraries(echo LibMain)
+target_link_libraries(env LibMain)
target_link_libraries(expr LibRegex LibMain)
target_link_libraries(fdtdump LibDeviceTree LibMain)
target_link_libraries(file LibGfx LibIPC LibCompress LibMain)
diff --git a/Userland/Utilities/env.cpp b/Userland/Utilities/env.cpp
index 3b4bfcf668..f73ef75809 100644
--- a/Userland/Utilities/env.cpp
+++ b/Userland/Utilities/env.cpp
@@ -6,16 +6,15 @@
#include <LibCore/ArgsParser.h>
#include <LibCore/DirIterator.h>
+#include <LibCore/System.h>
+#include <LibMain/Main.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-int main(int argc, char** argv)
+ErrorOr<int> serenity_main(Main::Arguments arguments)
{
- if (pledge("stdio rpath exec", nullptr) < 0) {
- perror("pledge");
- return 1;
- }
+ TRY(Core::System::pledge("stdio rpath exec"));
bool ignore_env = false;
const char* split_string = nullptr;
@@ -28,7 +27,7 @@ int main(int argc, char** argv)
args_parser.add_option(split_string, "Process and split S into separate arguments; used to pass multiple arguments on shebang lines", "split-string", 'S', "S");
args_parser.add_positional_argument(values, "Environment and commands", "env/command", Core::ArgsParser::Required::No);
- args_parser.parse(argc, argv);
+ args_parser.parse(arguments);
if (ignore_env)
clearenv();