1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:07:35 +00:00

mv: Port to LibMain

This commit is contained in:
Fabian INGREMEAU 2022-01-23 18:09:30 +01:00 committed by Brian Gianforcaro
parent daf7f72ff3
commit dff6460373
2 changed files with 7 additions and 7 deletions

View file

@ -132,6 +132,7 @@ target_link_libraries(mkdir LibMain)
target_link_libraries(mkfifo LibMain)
target_link_libraries(mknod LibMain)
target_link_libraries(mktemp LibMain)
target_link_libraries(mv LibMain)
target_link_libraries(nc LibMain)
target_link_libraries(netstat LibMain)
target_link_libraries(notify LibGUI)

View file

@ -8,17 +8,16 @@
#include <AK/String.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
int main(int argc, char** argv)
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
if (pledge("stdio rpath wpath cpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
TRY(Core::System::pledge("stdio rpath wpath cpath fattr"));
// NOTE: The "force" option is a dummy for now, it's just here to silence scripts that use "mv -f"
// In the future, it might be used to cancel out an "-i" interactive option.
@ -31,10 +30,10 @@ int main(int argc, char** argv)
args_parser.add_option(force, "Force", "force", 'f');
args_parser.add_option(verbose, "Verbose", "verbose", 'v');
args_parser.add_positional_argument(paths, "Paths to files being moved followed by target location", "paths");
args_parser.parse(argc, argv);
args_parser.parse(arguments);
if (paths.size() < 2) {
args_parser.print_usage(stderr, argv[0]);
args_parser.print_usage(stderr, arguments.argv[0]);
return 1;
}