Charles Hardin made adig support a regular numerical dotted IP address for the

-s option as well.
pull/1/head
Daniel Stenberg 17 years ago
parent f5840c42bd
commit 43daf6decd
  1. 4
      CHANGES
  2. 7
      adig.c

@ -1,5 +1,9 @@
Changelog for the c-ares project Changelog for the c-ares project
* Oct 18 2008 (Daniel Stenberg)
Charles Hardin made adig support a regular numerical dotted IP address for the
-s option as well.
* Oct 7 2008 (Yang Tse) * Oct 7 2008 (Yang Tse)
- Added --enable-optimize configure option to enable and disable compiler - Added --enable-optimize configure option to enable and disable compiler
optimizations to allow decoupled setting from --enable-debug. optimizations to allow decoupled setting from --enable-debug.

@ -151,6 +151,7 @@ static const char *opcodes[] = {
"UPDATEA", "UPDATED", "UPDATEDA", "UPDATEM", "UPDATEMA", "UPDATEA", "UPDATED", "UPDATEDA", "UPDATEM", "UPDATEMA",
"ZONEINIT", "ZONEREF" "ZONEINIT", "ZONEREF"
}; };
struct in_addr inaddr;
static const char *rcodes[] = { static const char *rcodes[] = {
"NOERROR", "FORMERR", "SERVFAIL", "NXDOMAIN", "NOTIMP", "REFUSED", "NOERROR", "FORMERR", "SERVFAIL", "NXDOMAIN", "NOTIMP", "REFUSED",
@ -212,12 +213,16 @@ int main(int argc, char **argv)
case 's': case 's':
/* Add a server, and specify servers in the option mask. */ /* Add a server, and specify servers in the option mask. */
if (inet_pton(AF_INET, optarg, &inaddr) <= 0)
{
hostent = gethostbyname(optarg); hostent = gethostbyname(optarg);
if (!hostent || hostent->h_addrtype != AF_INET) if (!hostent || hostent->h_addrtype != AF_INET)
{ {
fprintf(stderr, "adig: server %s not found.\n", optarg); fprintf(stderr, "adig: server %s not found.\n", optarg);
return 1; return 1;
} }
memcpy(&inaddr, hostent->h_addr, sizeof(struct in_addr));
}
options.servers = realloc(options.servers, (options.nservers + 1) options.servers = realloc(options.servers, (options.nservers + 1)
* sizeof(struct in_addr)); * sizeof(struct in_addr));
if (!options.servers) if (!options.servers)
@ -225,7 +230,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Out of memory!\n"); fprintf(stderr, "Out of memory!\n");
return 1; return 1;
} }
memcpy(&options.servers[options.nservers], hostent->h_addr, memcpy(&options.servers[options.nservers], &inaddr,
sizeof(struct in_addr)); sizeof(struct in_addr));
options.nservers++; options.nservers++;
optmask |= ARES_OPT_SERVERS; optmask |= ARES_OPT_SERVERS;

Loading…
Cancel
Save