summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Utilities/CMakeLists.txt1
-rw-r--r--Userland/Utilities/basename.cpp13
2 files changed, 6 insertions, 8 deletions
diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt
index 8847e38664..4f61fc0a4a 100644
--- a/Userland/Utilities/CMakeLists.txt
+++ b/Userland/Utilities/CMakeLists.txt
@@ -55,6 +55,7 @@ target_link_libraries(aplay LibAudio)
target_link_libraries(arp LibMain)
target_link_libraries(asctl LibAudio)
target_link_libraries(base64 LibMain)
+target_link_libraries(basename LibMain)
target_link_libraries(bt LibSymbolication)
target_link_libraries(blockdev LibMain)
target_link_libraries(cat LibMain)
diff --git a/Userland/Utilities/basename.cpp b/Userland/Utilities/basename.cpp
index fa2b480f1d..08b842ba22 100644
--- a/Userland/Utilities/basename.cpp
+++ b/Userland/Utilities/basename.cpp
@@ -6,15 +6,12 @@
#include <AK/LexicalPath.h>
#include <LibCore/ArgsParser.h>
-#include <stdio.h>
-#include <unistd.h>
+#include <LibCore/System.h>
+#include <LibMain/Main.h>
-int main(int argc, char** argv)
+ErrorOr<int> serenity_main(Main::Arguments arguments)
{
- if (pledge("stdio", nullptr) < 0) {
- perror("pledge");
- return 1;
- }
+ TRY(Core::System::pledge("stdio", nullptr));
StringView path;
StringView suffix;
@@ -22,7 +19,7 @@ int main(int argc, char** argv)
Core::ArgsParser args_parser;
args_parser.add_positional_argument(path, "Path to get basename from", "path");
args_parser.add_positional_argument(suffix, "Suffix to strip from name", "suffix", Core::ArgsParser::Required::No);
- args_parser.parse(argc, argv);
+ args_parser.parse(arguments);
auto result = LexicalPath::basename(path);