1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:14:58 +00:00

printf: Port to LibMain

This commit is contained in:
Brian Gianforcaro 2022-03-20 13:30:32 -07:00 committed by Andreas Kling
parent dba23c55dd
commit 544609b40f
2 changed files with 8 additions and 3 deletions

View file

@ -9,6 +9,7 @@
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/Types.h>
#include <LibMain/Main.h>
#include <stdio.h>
#include <unistd.h>
@ -253,10 +254,13 @@ static String handle_escapes(const char* string)
return builder.build();
}
int main(int argc, char** argv)
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
if (argc < 2)
return 1;
if (arguments.argc < 2)
return Error::from_errno(EINVAL);
auto argc = arguments.argc;
auto argv = arguments.argv;
++argv;
String format = handle_escapes(*(argv++));