mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
which: Port to LibMain
This commit is contained in:
parent
92493b210a
commit
fc78bbe78c
2 changed files with 5 additions and 6 deletions
|
@ -162,6 +162,7 @@ target_link_libraries(cpp-parser LibCpp LibGUI)
|
||||||
target_link_libraries(cpp-preprocessor LibCpp LibGUI)
|
target_link_libraries(cpp-preprocessor LibCpp LibGUI)
|
||||||
target_link_libraries(w LibMain)
|
target_link_libraries(w LibMain)
|
||||||
target_link_libraries(wasm LibWasm LibLine)
|
target_link_libraries(wasm LibWasm LibLine)
|
||||||
|
target_link_libraries(which LibMain)
|
||||||
target_link_libraries(whoami LibMain)
|
target_link_libraries(whoami LibMain)
|
||||||
target_link_libraries(watch LibMain)
|
target_link_libraries(watch LibMain)
|
||||||
target_link_libraries(wsctl LibGUI LibMain)
|
target_link_libraries(wsctl LibGUI LibMain)
|
||||||
|
|
|
@ -6,21 +6,19 @@
|
||||||
|
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/DirIterator.h>
|
#include <LibCore/DirIterator.h>
|
||||||
|
#include <LibCore/System.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* filename = nullptr;
|
const char* filename = nullptr;
|
||||||
|
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
args_parser.add_positional_argument(filename, "Name of executable", "executable");
|
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);
|
auto fullpath = Core::find_executable_in_path(filename);
|
||||||
if (fullpath.is_null()) {
|
if (fullpath.is_null()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue