Add -t u option to ahost

Add an option to allow specification of the AF_UNSPEC
address family.
pull/16/merge
David Drysdale 11 years ago
parent c1fe47f6d9
commit 2bc07b2e74
  1. 1
      ahost.1
  2. 4
      ahost.c

@ -23,6 +23,7 @@ Display this help and exit.
\fB\-t\fR type \fB\-t\fR type
If type is "a", print the A record (default). If type is "a", print the A record (default).
If type is "aaaa", print the AAAA record. If type is "aaaa", print the AAAA record.
If type is "u", look for either AAAA or A record (in that order).
.TP .TP
\fB\-s\fR \fIdomain\fP \fB\-s\fR \fIdomain\fP
Specify the \fIdomain\fP to search instead of using the default values from Specify the \fIdomain\fP to search instead of using the default values from

@ -96,6 +96,8 @@ int main(int argc, char **argv)
addr_family = AF_INET; addr_family = AF_INET;
else if (!strcasecmp(optarg,"aaaa")) else if (!strcasecmp(optarg,"aaaa"))
addr_family = AF_INET6; addr_family = AF_INET6;
else if (!strcasecmp(optarg,"u"))
addr_family = AF_UNSPEC;
else else
usage(); usage();
break; break;
@ -195,6 +197,6 @@ static void callback(void *arg, int status, int timeouts, struct hostent *host)
static void usage(void) static void usage(void)
{ {
fprintf(stderr, "usage: ahost [-t {a|aaaa}] {host|addr} ...\n"); fprintf(stderr, "usage: ahost [-t {a|aaaa|u}] {host|addr} ...\n");
exit(1); exit(1);
} }

Loading…
Cancel
Save