mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 19:05:08 +00:00
ping: Port to LibMain
This commit is contained in:
parent
31c1094577
commit
2af9a8e862
2 changed files with 6 additions and 6 deletions
|
@ -142,6 +142,7 @@ target_link_libraries(pape LibGUI)
|
||||||
target_link_libraries(passwd LibCrypt LibMain)
|
target_link_libraries(passwd LibCrypt LibMain)
|
||||||
target_link_libraries(paste LibGUI)
|
target_link_libraries(paste LibGUI)
|
||||||
target_link_libraries(pgrep LibRegex)
|
target_link_libraries(pgrep LibRegex)
|
||||||
|
target_link_libraries(ping LibMain)
|
||||||
target_link_libraries(pls LibCrypt LibMain)
|
target_link_libraries(pls LibCrypt LibMain)
|
||||||
target_link_libraries(pmap LibMain)
|
target_link_libraries(pmap LibMain)
|
||||||
target_link_libraries(pmemdump LibMain)
|
target_link_libraries(pmemdump LibMain)
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
|
#include <LibCore/System.h>
|
||||||
|
#include <LibMain/Main.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
@ -55,18 +57,15 @@ static void closing_statistics()
|
||||||
exit(0);
|
exit(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
if (pledge("stdio id inet unix sigaction", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio id inet unix sigaction"));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
args_parser.add_positional_argument(host, "Host to ping", "host");
|
args_parser.add_positional_argument(host, "Host to ping", "host");
|
||||||
args_parser.add_option(count, "Stop after sending specified number of ECHO_REQUEST packets.", "count", 'c', "count");
|
args_parser.add_option(count, "Stop after sending specified number of ECHO_REQUEST packets.", "count", 'c', "count");
|
||||||
args_parser.add_option(payload_size, "Amount of bytes to send as payload in the ECHO_REQUEST packets.", "size", 's', "size");
|
args_parser.add_option(payload_size, "Amount of bytes to send as payload in the ECHO_REQUEST packets.", "size", 's', "size");
|
||||||
args_parser.parse(argc, argv);
|
args_parser.parse(arguments);
|
||||||
|
|
||||||
if (payload_size < 0) {
|
if (payload_size < 0) {
|
||||||
// Use the default.
|
// Use the default.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue