mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:47:35 +00:00
rev: Port to LibMain
This commit is contained in:
parent
4eb5fdcfe0
commit
4e02b204ef
2 changed files with 7 additions and 10 deletions
|
@ -144,6 +144,7 @@ target_link_libraries(pmemdump LibMain)
|
||||||
target_link_libraries(pro LibMain LibProtocol)
|
target_link_libraries(pro LibMain LibProtocol)
|
||||||
target_link_libraries(ps LibMain)
|
target_link_libraries(ps LibMain)
|
||||||
target_link_libraries(pwd LibMain)
|
target_link_libraries(pwd LibMain)
|
||||||
|
target_link_libraries(rev LibMain)
|
||||||
target_link_libraries(run-tests LibRegex)
|
target_link_libraries(run-tests LibRegex)
|
||||||
target_link_libraries(shot LibGUI)
|
target_link_libraries(shot LibGUI)
|
||||||
target_link_libraries(sql LibLine LibSQL LibIPC)
|
target_link_libraries(sql LibLine LibSQL LibIPC)
|
||||||
|
|
|
@ -5,23 +5,22 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
|
#include <LibCore/System.h>
|
||||||
|
#include <LibMain/Main.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
if (pledge("stdio rpath", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio rpath"sv));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector<StringView> paths;
|
Vector<StringView> paths;
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
|
|
||||||
args_parser.set_general_help("Concatente files to stdout with each line in reverse.");
|
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.add_positional_argument(paths, "File path", "path", Core::ArgsParser::Required::No);
|
||||||
args_parser.parse(argc, argv);
|
args_parser.parse(arguments);
|
||||||
|
|
||||||
Vector<FILE*> streams;
|
Vector<FILE*> streams;
|
||||||
auto num_paths = paths.size();
|
auto num_paths = paths.size();
|
||||||
|
@ -49,10 +48,7 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (pledge("stdio", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio"sv));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto* stream : streams) {
|
for (auto* stream : streams) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue