mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
Utilities: Port realpath to LibMain
This commit is contained in:
parent
2e87a5b7eb
commit
65de0d2910
Notes:
sideshowbarker
2024-07-17 19:04:16 +09:00
Author: https://github.com/ryangjchandler Commit: https://github.com/SerenityOS/serenity/commit/65de0d2910 Pull-request: https://github.com/SerenityOS/serenity/pull/12377 Reviewed-by: https://github.com/AtkinsSJ ✅
@ -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)
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user