Utilities: Port realpath to LibMain

This commit is contained in:
Ryan Chandler 2022-02-09 10:43:21 +00:00 committed by Linus Groh
parent 2e87a5b7eb
commit 65de0d2910
Notes: sideshowbarker 2024-07-17 19:04:16 +09:00
2 changed files with 6 additions and 6 deletions

View File

@ -154,6 +154,7 @@ target_link_libraries(pmemdump LibMain)
target_link_libraries(pro LibMain LibProtocol)
target_link_libraries(ps LibMain)
target_link_libraries(pwd LibMain)
target_link_libraries(realpath LibMain)
target_link_libraries(rev LibMain)
target_link_libraries(rm LibMain)
target_link_libraries(rmdir LibMain)

View File

@ -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) {