Loading ares/ahost.c +34 −8 Original line number Diff line number Diff line /* Copyright 1998 by the Massachusetts Institute of Technology. * * $Id$ * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without Loading Loading @@ -30,6 +32,10 @@ #include <stdlib.h> #include <string.h> #ifdef HAVE_GETOPT_H #include <getopt.h> #endif #include "ares.h" #include "ares_dns.h" #include "inet_ntop.h" Loading @@ -52,7 +58,7 @@ static void usage(void); int main(int argc, char **argv) { ares_channel channel; int status, nfds; int status, nfds, c, addr_family = AF_INET; fd_set read_fds, write_fds; struct timeval *tvp, tv; struct in_addr addr4; Loading @@ -64,7 +70,28 @@ int main(int argc, char **argv) WSAStartup(wVersionRequested, &wsaData); #endif if (argc <= 1) while ((c = getopt(argc,argv,"t:h")) != -1) { switch (c) { case 't': if (!strcasecmp(optarg,"a")) addr_family = AF_INET; else if (!strcasecmp(optarg,"aaaa")) addr_family = AF_INET6; else usage(); break; case 'h': default: usage(); break; } } argc -= optind; argv += optind; if (argc < 1) usage(); status = ares_init(&channel); Loading @@ -75,7 +102,7 @@ int main(int argc, char **argv) } /* Initiate the queries, one per command-line argument. */ for (argv++; *argv; argv++) for ( ; *argv; argv++) { if (ares_inet_pton(AF_INET, *argv, &addr4) == 1) { Loading @@ -89,8 +116,7 @@ int main(int argc, char **argv) } else { /* assume user wants A-records */ ares_gethostbyname(channel, *argv, AF_INET, callback, *argv); ares_gethostbyname(channel, *argv, addr_family, callback, *argv); } } Loading Loading @@ -143,6 +169,6 @@ static void callback(void *arg, int status, struct hostent *host) static void usage(void) { fprintf(stderr, "usage: ahost {host|addr} ...\n"); fprintf(stderr, "usage: ahost [-t {a|aaaa}] {host|addr} ...\n"); exit(1); } Loading
ares/ahost.c +34 −8 Original line number Diff line number Diff line /* Copyright 1998 by the Massachusetts Institute of Technology. * * $Id$ * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without Loading Loading @@ -30,6 +32,10 @@ #include <stdlib.h> #include <string.h> #ifdef HAVE_GETOPT_H #include <getopt.h> #endif #include "ares.h" #include "ares_dns.h" #include "inet_ntop.h" Loading @@ -52,7 +58,7 @@ static void usage(void); int main(int argc, char **argv) { ares_channel channel; int status, nfds; int status, nfds, c, addr_family = AF_INET; fd_set read_fds, write_fds; struct timeval *tvp, tv; struct in_addr addr4; Loading @@ -64,7 +70,28 @@ int main(int argc, char **argv) WSAStartup(wVersionRequested, &wsaData); #endif if (argc <= 1) while ((c = getopt(argc,argv,"t:h")) != -1) { switch (c) { case 't': if (!strcasecmp(optarg,"a")) addr_family = AF_INET; else if (!strcasecmp(optarg,"aaaa")) addr_family = AF_INET6; else usage(); break; case 'h': default: usage(); break; } } argc -= optind; argv += optind; if (argc < 1) usage(); status = ares_init(&channel); Loading @@ -75,7 +102,7 @@ int main(int argc, char **argv) } /* Initiate the queries, one per command-line argument. */ for (argv++; *argv; argv++) for ( ; *argv; argv++) { if (ares_inet_pton(AF_INET, *argv, &addr4) == 1) { Loading @@ -89,8 +116,7 @@ int main(int argc, char **argv) } else { /* assume user wants A-records */ ares_gethostbyname(channel, *argv, AF_INET, callback, *argv); ares_gethostbyname(channel, *argv, addr_family, callback, *argv); } } Loading Loading @@ -143,6 +169,6 @@ static void callback(void *arg, int status, struct hostent *host) static void usage(void) { fprintf(stderr, "usage: ahost {host|addr} ...\n"); fprintf(stderr, "usage: ahost [-t {a|aaaa}] {host|addr} ...\n"); exit(1); }