mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 16:35:08 +00:00
arp: Port to LibMain
This commit is contained in:
parent
7d2170246f
commit
f47d92af72
2 changed files with 8 additions and 16 deletions
|
@ -52,6 +52,7 @@ foreach(CMD_SRC ${CMD_SOURCES})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
target_link_libraries(aplay LibAudio)
|
target_link_libraries(aplay LibAudio)
|
||||||
|
target_link_libraries(arp LibMain)
|
||||||
target_link_libraries(asctl LibAudio)
|
target_link_libraries(asctl LibAudio)
|
||||||
target_link_libraries(bt LibSymbolication)
|
target_link_libraries(bt LibSymbolication)
|
||||||
target_link_libraries(checksum LibCrypto)
|
target_link_libraries(checksum LibCrypto)
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
|
#include <LibCore/System.h>
|
||||||
|
#include <LibMain/Main.h>
|
||||||
#include <net/if_arp.h>
|
#include <net/if_arp.h>
|
||||||
#include <net/route.h>
|
#include <net/route.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
@ -21,22 +23,11 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
if (pledge("stdio rpath tty", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio rpath tty", nullptr));
|
||||||
perror("pledge");
|
TRY(Core::System::unveil("/proc/net/arp", "r"));
|
||||||
return 1;
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil("/proc/net/arp", "r") < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil(nullptr, nullptr) < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool flag_set;
|
static bool flag_set;
|
||||||
static bool flag_delete;
|
static bool flag_delete;
|
||||||
|
@ -49,7 +40,7 @@ int main(int argc, char** argv)
|
||||||
args_parser.add_option(flag_delete, "Delete an ARP table entry", "delete", 'd');
|
args_parser.add_option(flag_delete, "Delete an ARP table entry", "delete", 'd');
|
||||||
args_parser.add_positional_argument(value_ipv4_address, "IPv4 protocol address", "address", Core::ArgsParser::Required::No);
|
args_parser.add_positional_argument(value_ipv4_address, "IPv4 protocol address", "address", Core::ArgsParser::Required::No);
|
||||||
args_parser.add_positional_argument(value_hw_address, "Hardware address", "hwaddress", Core::ArgsParser::Required::No);
|
args_parser.add_positional_argument(value_hw_address, "Hardware address", "hwaddress", Core::ArgsParser::Required::No);
|
||||||
args_parser.parse(argc, argv);
|
args_parser.parse(arguments);
|
||||||
|
|
||||||
enum class Alignment {
|
enum class Alignment {
|
||||||
Left,
|
Left,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue