From 601b60324a3f3b5c5c4b840ef06ee8d0d7d6f2fd Mon Sep 17 00:00:00 2001 From: Kenneth Myhra Date: Sat, 27 Nov 2021 20:50:00 +0100 Subject: [PATCH] comm: Port to LibMain :^) --- Userland/Utilities/CMakeLists.txt | 1 + Userland/Utilities/comm.cpp | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt index ded9fda0e7b..9fc47bbff83 100644 --- a/Userland/Utilities/CMakeLists.txt +++ b/Userland/Utilities/CMakeLists.txt @@ -69,6 +69,7 @@ target_link_libraries(chown LibMain) target_link_libraries(chres LibGUI LibMain) target_link_libraries(cksum LibCrypto LibMain) target_link_libraries(clear LibMain) +target_link_libraries(comm LibMain) target_link_libraries(config LibConfig) target_link_libraries(copy LibGUI LibMain) target_link_libraries(cp LibMain) diff --git a/Userland/Utilities/comm.cpp b/Userland/Utilities/comm.cpp index 3155894e73f..346bbd2e6a0 100644 --- a/Userland/Utilities/comm.cpp +++ b/Userland/Utilities/comm.cpp @@ -6,6 +6,8 @@ #include #include +#include +#include #include #include #include @@ -14,12 +16,9 @@ #define COL2_COLOR "\x1B[34m{}\x1B[0m" #define COL3_COLOR "\x1B[31m{}\x1B[0m" -int main(int argc, char** argv) +ErrorOr serenity_main(Main::Arguments arguments) { - if (pledge("stdio rpath", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio rpath", nullptr)); String file1_path, file2_path; bool suppress_col1 { false }; @@ -41,7 +40,7 @@ int main(int argc, char** argv) args_parser.add_option(print_total, "Print a summary", "total", 't'); args_parser.add_positional_argument(file1_path, "First file to compare", "file1"); args_parser.add_positional_argument(file2_path, "Second file to compare", "file2"); - args_parser.parse(argc, argv); + args_parser.parse(arguments); if (color && no_color) { warnln("Cannot specify 'color' and 'no-color' together");