diff --git a/CHANGES b/CHANGES index 9a972004bf..5900b39790 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ + 993. [func] dig: -v now reports the version. + 992. [doc] dig: ~/.digrc is now documented. 991. [func] Lower UDP refresh timeout messages to level diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 5a6964f69b..e9fa1d709c 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.c,v 1.160 2001/09/12 21:48:41 gson Exp $ */ +/* $Id: dig.c,v 1.161 2001/09/13 01:42:21 marka Exp $ */ #include #include @@ -137,13 +137,18 @@ print_usage(FILE *fp) { } static void -usage() { +usage(void) { print_usage(stderr); fputs("\nUse \"dig -h\" (or \"dig -h | more\") " "for complete list of options\n", stderr); exit(1); } +static void +version(void) { + fputs("DiG " VERSION "\n", stderr); +} + static void help(void) { print_usage(stdout); @@ -195,7 +200,9 @@ help(void) { " +[no]dnssec (Request DNSSEC records)\n" " +[no]multiline (Print records in an expanded format)\n" " global d-opts and servers (before host name) affect all queries.\n" -" local d-opts and servers (after host name) affect only that lookup.\n", +" local d-opts and servers (after host name) affect only that lookup.\n" +" -h (print help and exit)\n" +" -v (print version and exit)\n", stdout); } @@ -932,6 +939,10 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, case 'n': nibble = ISC_TRUE; return (ISC_FALSE); + case 'v': + version(); + exit(0); + break; } if (value == NULL) goto invalid_option;