rev: Port to LibMain
This commit is contained in:
parent
4eb5fdcfe0
commit
4e02b204ef
Notes:
sideshowbarker
2024-07-17 20:20:34 +09:00
Author: https://github.com/mhermier Commit: https://github.com/SerenityOS/serenity/commit/4e02b204efc Pull-request: https://github.com/SerenityOS/serenity/pull/12088 Reviewed-by: https://github.com/kennethmyhra
2 changed files with 7 additions and 10 deletions
Userland/Utilities
|
@ -144,6 +144,7 @@ target_link_libraries(pmemdump LibMain)
|
|||
target_link_libraries(pro LibMain LibProtocol)
|
||||
target_link_libraries(ps LibMain)
|
||||
target_link_libraries(pwd LibMain)
|
||||
target_link_libraries(rev LibMain)
|
||||
target_link_libraries(run-tests LibRegex)
|
||||
target_link_libraries(shot LibGUI)
|
||||
target_link_libraries(sql LibLine LibSQL LibIPC)
|
||||
|
|
|
@ -5,23 +5,22 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
if (pledge("stdio rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio rpath"sv));
|
||||
|
||||
Vector<StringView> paths;
|
||||
Core::ArgsParser args_parser;
|
||||
|
||||
args_parser.set_general_help("Concatente files to stdout with each line in reverse.");
|
||||
args_parser.add_positional_argument(paths, "File path", "path", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(argc, argv);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
Vector<FILE*> streams;
|
||||
auto num_paths = paths.size();
|
||||
|
@ -49,10 +48,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
};
|
||||
|
||||
if (pledge("stdio", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio"sv));
|
||||
|
||||
for (auto* stream : streams) {
|
||||
for (;;) {
|
||||
|
|
Loading…
Add table
Reference in a new issue