mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:57:45 +00:00
Utilities: Port realpath to LibMain
This commit is contained in:
parent
2e87a5b7eb
commit
65de0d2910
2 changed files with 6 additions and 6 deletions
|
@ -154,6 +154,7 @@ target_link_libraries(pmemdump LibMain)
|
||||||
target_link_libraries(pro LibMain LibProtocol)
|
target_link_libraries(pro LibMain LibProtocol)
|
||||||
target_link_libraries(ps LibMain)
|
target_link_libraries(ps LibMain)
|
||||||
target_link_libraries(pwd LibMain)
|
target_link_libraries(pwd LibMain)
|
||||||
|
target_link_libraries(realpath LibMain)
|
||||||
target_link_libraries(rev LibMain)
|
target_link_libraries(rev LibMain)
|
||||||
target_link_libraries(rm LibMain)
|
target_link_libraries(rm LibMain)
|
||||||
target_link_libraries(rmdir LibMain)
|
target_link_libraries(rmdir LibMain)
|
||||||
|
|
|
@ -5,15 +5,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
|
#include <LibCore/System.h>
|
||||||
|
#include <LibMain/Main.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
if (pledge("stdio rpath", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio rpath"));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* path;
|
const char* path;
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ int main(int argc, char** argv)
|
||||||
args_parser.set_general_help(
|
args_parser.set_general_help(
|
||||||
"Show the 'real' path of a file, by resolving all symbolic links along the way.");
|
"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.add_positional_argument(path, "Path to resolve", "path");
|
||||||
args_parser.parse(argc, argv);
|
args_parser.parse(arguments);
|
||||||
|
|
||||||
char* value = realpath(path, nullptr);
|
char* value = realpath(path, nullptr);
|
||||||
if (value == nullptr) {
|
if (value == nullptr) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue