yes: Port to LibMain

This commit is contained in:
mjz19910 2022-01-03 20:04:15 -07:00 committed by Brian Gianforcaro
parent e9a15995fd
commit f705f57d9a
Notes: sideshowbarker 2024-07-17 21:43:49 +09:00
2 changed files with 5 additions and 6 deletions

View file

@ -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)

View file

@ -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);