summaryrefslogtreecommitdiff
path: root/Userland/Utilities/realpath.cpp
diff options
context:
space:
mode:
authorRyan Chandler <ryangjchandler@gmail.com>2022-02-09 10:43:21 +0000
committerLinus Groh <mail@linusgroh.de>2022-02-10 10:25:36 +0000
commit65de0d291094c0a8dfc9267378479041c94b8658 (patch)
treedc0c60d5b8e66cc0d468f5f7519bc3e2e1d84a79 /Userland/Utilities/realpath.cpp
parent2e87a5b7eb7ff28f1231fe4fe7967df9d567a95f (diff)
downloadserenity-65de0d291094c0a8dfc9267378479041c94b8658.zip
Utilities: Port realpath to LibMain
Diffstat (limited to 'Userland/Utilities/realpath.cpp')
-rw-r--r--Userland/Utilities/realpath.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/Userland/Utilities/realpath.cpp b/Userland/Utilities/realpath.cpp
index 0f48afb494..bd5bbb54d7 100644
--- a/Userland/Utilities/realpath.cpp
+++ b/Userland/Utilities/realpath.cpp
@@ -5,15 +5,14 @@
*/
#include <LibCore/ArgsParser.h>
+#include <LibCore/System.h>
+#include <LibMain/Main.h>
#include <stdio.h>
#include <unistd.h>
-int main(int argc, char** argv)
+ErrorOr<int> serenity_main(Main::Arguments arguments)
{
- if (pledge("stdio rpath", nullptr) < 0) {
- perror("pledge");
- return 1;
- }
+ TRY(Core::System::pledge("stdio rpath"));
const char* path;
@@ -21,7 +20,7 @@ int main(int argc, char** argv)
args_parser.set_general_help(
"Show the 'real' path of a file, by resolving all symbolic links along the way.");
args_parser.add_positional_argument(path, "Path to resolve", "path");
- args_parser.parse(argc, argv);
+ args_parser.parse(arguments);
char* value = realpath(path, nullptr);
if (value == nullptr) {