diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt index 64088b1a7e3..dd52f0a639e 100644 --- a/Userland/Utilities/CMakeLists.txt +++ b/Userland/Utilities/CMakeLists.txt @@ -149,6 +149,7 @@ target_link_libraries(top LibMain) target_link_libraries(touch LibMain) target_link_libraries(truncate LibMain) target_link_libraries(tt LibPthread) +target_link_libraries(uname LibMain) target_link_libraries(uniq LibMain) target_link_libraries(unzip LibArchive LibCompress) target_link_libraries(uptime LibMain) diff --git a/Userland/Utilities/uname.cpp b/Userland/Utilities/uname.cpp index d8b84592fc6..b6197d02404 100644 --- a/Userland/Utilities/uname.cpp +++ b/Userland/Utilities/uname.cpp @@ -8,16 +8,14 @@ #include #include #include +#include #include #include #include -int main(int argc, char** argv) +ErrorOr serenity_main(Main::Arguments arguments) { - if (pledge("stdio", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio")); bool flag_system = false; bool flag_node = false; @@ -31,7 +29,7 @@ int main(int argc, char** argv) args_parser.add_option(flag_release, "Print the system release", nullptr, 'r'); args_parser.add_option(flag_machine, "Print the machine hardware name", nullptr, 'm'); args_parser.add_option(flag_all, "Print all information (same as -snrm)", nullptr, 'a'); - args_parser.parse(argc, argv); + args_parser.parse(arguments); if (flag_all) flag_system = flag_node = flag_release = flag_machine = true; @@ -39,12 +37,7 @@ int main(int argc, char** argv) if (!flag_system && !flag_node && !flag_release && !flag_machine) flag_system = true; - utsname uts; - int rc = uname(&uts); - if (rc < 0) { - perror("uname() failed"); - return 0; - } + utsname uts = TRY(Core::System::uname()); Vector parts; if (flag_system)