mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +00:00
which: Port to LibMain
This commit is contained in:
parent
92493b210a
commit
fc78bbe78c
2 changed files with 5 additions and 6 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue