mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
yes: Port to LibMain
This commit is contained in:
parent
e9a15995fd
commit
f705f57d9a
Notes:
sideshowbarker
2024-07-17 21:43:49 +09:00
Author: https://github.com/mjz19910 Commit: https://github.com/SerenityOS/serenity/commit/f705f57d9a3 Pull-request: https://github.com/SerenityOS/serenity/pull/11607 Reviewed-by: https://github.com/bgianfo
2 changed files with 5 additions and 6 deletions
|
@ -165,3 +165,4 @@ target_link_libraries(wasm LibWasm LibLine)
|
|||
target_link_libraries(whoami LibMain)
|
||||
target_link_libraries(watch LibMain)
|
||||
target_link_libraries(wsctl LibGUI)
|
||||
target_link_libraries(yes LibMain)
|
||||
|
|
|
@ -5,21 +5,19 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ArgsParser.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", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio"));
|
||||
|
||||
const char* string = "yes";
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(string, "String to output (defaults to 'yes')", "string", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(argc, argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
for (;;)
|
||||
puts(string);
|
||||
|
|
Loading…
Reference in a new issue