mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
host: Port to LibMain
This commit is contained in:
parent
dbcccde062
commit
63466d385c
Notes:
sideshowbarker
2024-07-17 20:54:11 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/63466d385ca 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 8 deletions
|
@ -107,6 +107,7 @@ target_link_libraries(gunzip LibCompress LibMain)
|
|||
target_link_libraries(gzip LibCompress LibMain)
|
||||
target_link_libraries(head LibMain)
|
||||
target_link_libraries(hexdump LibMain)
|
||||
target_link_libraries(host LibMain)
|
||||
target_link_libraries(id LibMain)
|
||||
target_link_libraries(ini LibMain)
|
||||
target_link_libraries(jp LibMain)
|
||||
|
|
|
@ -5,25 +5,22 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
ErrorOr<int> serenity_main(Main::Arguments args)
|
||||
{
|
||||
if (pledge("stdio unix", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio unix", nullptr));
|
||||
|
||||
const char* name_or_ip = nullptr;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Convert between domain name and IPv4 address.");
|
||||
args_parser.add_positional_argument(name_or_ip, "Domain name or IPv4 address", "name");
|
||||
args_parser.parse(argc, argv);
|
||||
args_parser.parse(args);
|
||||
|
||||
// If input looks like an IPv4 address, we should do a reverse lookup.
|
||||
struct sockaddr_in addr;
|
||||
|
|
Loading…
Reference in a new issue