mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-08 01:27:31 +00:00
which: Port to LibMain
This commit is contained in:
committed by
Brian Gianforcaro
parent
92493b210a
commit
fc78bbe78c
@@ -162,6 +162,7 @@ target_link_libraries(cpp-parser LibCpp LibGUI)
|
||||
target_link_libraries(cpp-preprocessor LibCpp LibGUI)
|
||||
target_link_libraries(w LibMain)
|
||||
target_link_libraries(wasm LibWasm LibLine)
|
||||
target_link_libraries(which LibMain)
|
||||
target_link_libraries(whoami LibMain)
|
||||
target_link_libraries(watch LibMain)
|
||||
target_link_libraries(wsctl LibGUI LibMain)
|
||||
|
||||
@@ -6,21 +6,19 @@
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/System.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* filename = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(filename, "Name of executable", "executable");
|
||||
args_parser.parse(argc, argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto fullpath = Core::find_executable_in_path(filename);
|
||||
if (fullpath.is_null()) {
|
||||
|
||||
Reference in New Issue
Block a user