From a64b44377d93c22e2b60a1e46d16d92810a58fc6 Mon Sep 17 00:00:00 2001 From: Kenneth Myhra Date: Sun, 30 Jan 2022 11:17:58 +0100 Subject: [PATCH] nl: Port to LibMain --- Userland/Utilities/CMakeLists.txt | 1 + Userland/Utilities/nl.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt index f535f594b46..20f2447a3a9 100644 --- a/Userland/Utilities/CMakeLists.txt +++ b/Userland/Utilities/CMakeLists.txt @@ -138,6 +138,7 @@ target_link_libraries(mv LibMain) target_link_libraries(mount LibMain) target_link_libraries(nc LibMain) target_link_libraries(netstat LibMain) +target_link_libraries(nl LibMain) target_link_libraries(notify LibGUI) target_link_libraries(nproc LibMain) target_link_libraries(open LibDesktop) diff --git a/Userland/Utilities/nl.cpp b/Userland/Utilities/nl.cpp index c9752be16e4..28d080fdac5 100644 --- a/Userland/Utilities/nl.cpp +++ b/Userland/Utilities/nl.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -17,7 +18,7 @@ enum NumberStyle { NumberNoLines, }; -int main(int argc, char** argv) +ErrorOr serenity_main(Main::Arguments arguments) { NumberStyle number_style = NumberNonEmptyLines; int increment = 1; @@ -54,7 +55,7 @@ int main(int argc, char** argv) args_parser.add_option(start_number, "Initial line number", "startnum", 'v', "number"); args_parser.add_option(number_width, "Number width", "width", 'w', "number"); args_parser.add_positional_argument(files, "Files to process", "file", Core::ArgsParser::Required::No); - args_parser.parse(argc, argv); + args_parser.parse(arguments); Vector file_pointers; if (!files.is_empty()) {