mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
uniq: Port to LibMain
This commit is contained in:
parent
28ea412251
commit
35cd7c9a91
2 changed files with 5 additions and 6 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <AK/RefPtr.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -36,19 +37,16 @@ static FILE* get_stream(const char* filepath, const char* perms)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
if (pledge("stdio rpath wpath cpath", nullptr) > 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio rpath wpath cpath"));
|
||||
|
||||
const char* inpath = nullptr;
|
||||
const char* outpath = nullptr;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(inpath, "Input file", "input", Core::ArgsParser::Required::No);
|
||||
args_parser.add_positional_argument(outpath, "Output file", "output", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(argc, argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
FILE* infile = get_stream(inpath, "r");
|
||||
FILE* outfile = get_stream(outpath, "w");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue