umount: Port to LibMain

This commit is contained in:
Federico Guerinoni 2022-01-21 23:11:55 +01:00 committed by Idan Horowitz
parent 2291ef6c3c
commit e37af0b073
Notes: sideshowbarker 2024-07-17 20:27:18 +09:00
2 changed files with 7 additions and 9 deletions

View file

@ -160,6 +160,7 @@ target_link_libraries(top LibMain)
target_link_libraries(touch LibMain)
target_link_libraries(truncate LibMain)
target_link_libraries(tt LibPthread)
target_link_libraries(umount LibMain)
target_link_libraries(uname LibMain)
target_link_libraries(uniq LibMain)
target_link_libraries(unzip LibArchive LibCompress LibMain)

View file

@ -5,20 +5,17 @@
*/
#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)
{
const char* mount_point = nullptr;
StringView mount_point;
Core::ArgsParser args_parser;
args_parser.add_positional_argument(mount_point, "Mount point", "mountpoint");
args_parser.parse(argc, argv);
args_parser.parse(arguments);
if (umount(mount_point) < 0) {
perror("umount");
return 1;
}
TRY(Core::System::umount(mount_point));
return 0;
}