mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
head: Port to LibMain
This commit is contained in:
parent
5ac52d0e4c
commit
02cb34a48a
Notes:
sideshowbarker
2024-07-17 20:54:20 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/02cb34a48a7 Pull-request: https://github.com/SerenityOS/serenity/pull/11880 Reviewed-by: https://github.com/IdanHo Reviewed-by: https://github.com/mjz19910
2 changed files with 6 additions and 6 deletions
|
@ -105,6 +105,7 @@ target_link_libraries(gron LibMain)
|
|||
target_link_libraries(groups LibMain)
|
||||
target_link_libraries(gunzip LibCompress LibMain)
|
||||
target_link_libraries(gzip LibCompress LibMain)
|
||||
target_link_libraries(head LibMain)
|
||||
target_link_libraries(id LibMain)
|
||||
target_link_libraries(ini LibMain)
|
||||
target_link_libraries(jp LibMain)
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
@ -14,12 +16,9 @@
|
|||
|
||||
int head(const String& filename, bool print_filename, ssize_t line_count, ssize_t byte_count);
|
||||
|
||||
int main(int argc, char** argv)
|
||||
ErrorOr<int> serenity_main(Main::Arguments args)
|
||||
{
|
||||
if (pledge("stdio rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio rpath", nullptr));
|
||||
|
||||
int line_count = -1;
|
||||
int byte_count = -1;
|
||||
|
@ -34,7 +33,7 @@ int main(int argc, char** argv)
|
|||
args_parser.add_option(never_print_filenames, "Never print filenames", "quiet", 'q');
|
||||
args_parser.add_option(always_print_filenames, "Always print filenames", "verbose", 'v');
|
||||
args_parser.add_positional_argument(files, "File to process", "file", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(argc, argv);
|
||||
args_parser.parse(args);
|
||||
|
||||
if (line_count == -1 && byte_count == -1) {
|
||||
line_count = 10;
|
||||
|
|
Loading…
Reference in a new issue