From 2bc07b2e7432c42a94d65577293602efefd6eddd Mon Sep 17 00:00:00 2001 From: David Drysdale Date: Thu, 24 Jul 2014 11:18:46 +0100 Subject: [PATCH] Add -t u option to ahost Add an option to allow specification of the AF_UNSPEC address family. --- ahost.1 | 1 + ahost.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ahost.1 b/ahost.1 index e9b6d883..c83cfcf9 100644 --- a/ahost.1 +++ b/ahost.1 @@ -23,6 +23,7 @@ Display this help and exit. \fB\-t\fR type If type is "a", print the A record (default). If type is "aaaa", print the AAAA record. +If type is "u", look for either AAAA or A record (in that order). .TP \fB\-s\fR \fIdomain\fP Specify the \fIdomain\fP to search instead of using the default values from diff --git a/ahost.c b/ahost.c index 7a550c41..1b88d18c 100644 --- a/ahost.c +++ b/ahost.c @@ -96,6 +96,8 @@ int main(int argc, char **argv) addr_family = AF_INET; else if (!strcasecmp(optarg,"aaaa")) addr_family = AF_INET6; + else if (!strcasecmp(optarg,"u")) + addr_family = AF_UNSPEC; else usage(); break; @@ -195,6 +197,6 @@ static void callback(void *arg, int status, int timeouts, struct hostent *host) 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); }