summaryrefslogtreecommitdiff
path: root/Userland/Utilities/rm.cpp
diff options
context:
space:
mode:
authorAriel Abreu <facekapow@outlook.com>2022-01-24 20:58:47 -0500
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-01-25 02:50:10 +0000
commit0fea2203dc9a008208933a07dae56698c66f91bd (patch)
treee66cba7a4139abd425e04f18df85601b3b9ee75d /Userland/Utilities/rm.cpp
parent5f602e39e9b3a16e89d8ca4bba19494df39e0d54 (diff)
downloadserenity-0fea2203dc9a008208933a07dae56698c66f91bd.zip
rm: Port to LibMain
Diffstat (limited to 'Userland/Utilities/rm.cpp')
-rw-r--r--Userland/Utilities/rm.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/Userland/Utilities/rm.cpp b/Userland/Utilities/rm.cpp
index 8b6cb0a8e1..dd05c0719d 100644
--- a/Userland/Utilities/rm.cpp
+++ b/Userland/Utilities/rm.cpp
@@ -8,15 +8,14 @@
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/File.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 cpath", nullptr) < 0) {
- perror("pledge");
- return 1;
- }
+ TRY(Core::System::pledge("stdio rpath cpath"));
bool recursive = false;
bool force = false;
@@ -30,10 +29,10 @@ int main(int argc, char** argv)
args_parser.add_option(verbose, "Verbose", "verbose", 'v');
args_parser.add_option(no_preserve_root, "Do not consider '/' specially", "no-preserve-root", 0);
args_parser.add_positional_argument(paths, "Path(s) to remove", "path", Core::ArgsParser::Required::No);
- args_parser.parse(argc, argv);
+ args_parser.parse(arguments);
if (!force && paths.is_empty()) {
- args_parser.print_usage(stderr, argv[0]);
+ args_parser.print_usage(stderr, arguments.argv[0]);
return 1;
}