diff --git a/CHANGES b/CHANGES
index aa1f382f76..693fe1c51b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+3773. [func] "host", "nslookup" and "nsupdate" now have
+ options to print the version number and exit.
+ [RT #26057]
+
3770. [bug] "dig +trace" could fail with an assertion when it
needed to fall back to TCP due to a truncated
response. [RT #24660]
diff --git a/bin/dig/dig.docbook b/bin/dig/dig.docbook
index 08e0d6f22f..1052bf592f 100644
--- a/bin/dig/dig.docbook
+++ b/bin/dig/dig.docbook
@@ -70,6 +70,7 @@
+
@@ -285,6 +286,11 @@
name from other arguments.
+
+ The causes dig to
+ print the version number and exit.
+
+
Reverse lookups — mapping addresses to names — are simplified by the
option. addr is
diff --git a/bin/dig/host.c b/bin/dig/host.c
index d1392fc846..e3e13b73df 100644
--- a/bin/dig/host.c
+++ b/bin/dig/host.c
@@ -15,8 +15,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: host.c,v 1.127 2011/03/11 06:11:20 marka Exp $ */
-
/*! \file */
#include
@@ -166,7 +164,8 @@ show_usage(void) {
" -W specifies how long to wait for a reply\n"
" -4 use IPv4 query transport only\n"
" -6 use IPv6 query transport only\n"
-" -m set memory debugging flag (trace|record|usage)\n", stderr);
+" -m set memory debugging flag (trace|record|usage)\n"
+" -v print version number and exit\n", stderr);
exit(1);
}
@@ -603,7 +602,13 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
return (result);
}
-static const char * optstring = "46ac:dilnm:rst:vwCDN:R:TW:";
+static const char * optstring = "46ac:dilnm:rst:vVwCDN:R:TW:";
+
+/*% version */
+static void
+version(void) {
+ fputs("host " VERSION "\n", stderr);
+}
static void
pre_parse_args(int argc, char **argv) {
@@ -635,6 +640,10 @@ pre_parse_args(int argc, char **argv) {
case 's': break;
case 't': break;
case 'v': break;
+ case 'V':
+ version();
+ exit(0);
+ break;
case 'w': break;
case 'C': break;
case 'D':
diff --git a/bin/dig/host.docbook b/bin/dig/host.docbook
index f5ccd6eeb4..30fc441044 100644
--- a/bin/dig/host.docbook
+++ b/bin/dig/host.docbook
@@ -65,6 +65,8 @@
+
+
name
server
@@ -238,6 +240,11 @@
record, usage and
trace.
+
+
+ The option causes host
+ to print the version number and exit.
+
diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c
index 6c2f0a9499..21929ba610 100644
--- a/bin/dig/nslookup.c
+++ b/bin/dig/nslookup.c
@@ -15,8 +15,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: nslookup.c,v 1.130 2011/12/16 23:01:16 each Exp $ */
-
#include
#include
@@ -581,6 +579,11 @@ set_ndots(const char *value) {
ndots = n;
}
+static void
+version(void) {
+ fputs("nslookup " VERSION "\n", stderr);
+}
+
static void
setoption(char *opt) {
if (strncasecmp(opt, "all", 4) == 0) {
@@ -805,9 +808,12 @@ parse_args(int argc, char **argv) {
for (argc--, argv++; argc > 0; argc--, argv++) {
debug("main parsing %s", argv[0]);
if (argv[0][0] == '-') {
- if (argv[0][1] != 0)
+ if (strncasecmp(argv[0], "-ver", 4) == 0) {
+ version();
+ exit(0);
+ } else if (argv[0][1] != 0) {
setoption(&argv[0][1]);
- else
+ } else
have_lookup = ISC_TRUE;
} else {
if (!have_lookup) {
diff --git a/bin/dig/nslookup.docbook b/bin/dig/nslookup.docbook
index c757bcd34d..022de672b8 100644
--- a/bin/dig/nslookup.docbook
+++ b/bin/dig/nslookup.docbook
@@ -133,6 +133,11 @@ nslookup -query=hinfo -timeout=10
+
+ The option causes
+ nslookup to print the version
+ number and immediately exits.
+
diff --git a/bin/nsupdate/Makefile.in b/bin/nsupdate/Makefile.in
index 6546e9c7cc..5dc20ad907 100644
--- a/bin/nsupdate/Makefile.in
+++ b/bin/nsupdate/Makefile.in
@@ -30,7 +30,7 @@ DST_GSSAPI_INC = @DST_GSSAPI_INC@
CINCLUDES = ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
${ISC_INCLUDES} ${ISCCFG_INCLUDES} ${DST_GSSAPI_INC}
-CDEFINES = @USE_GSSAPI@
+CDEFINES = -DVERSION=\"${VERSION}\" @USE_GSSAPI@
CWARNINGS =
LWRESLIBS = ../../lib/lwres/liblwres.@A@
diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c
index b67a890dc9..b6375ab307 100644
--- a/bin/nsupdate/nsupdate.c
+++ b/bin/nsupdate/nsupdate.c
@@ -962,7 +962,7 @@ get_addresses(char *host, in_port_t port,
host, isc_result_totext(result));
}
-#define PARSE_ARGS_FMT "dDML:y:ghlovk:p:r:R::t:u:"
+#define PARSE_ARGS_FMT "dDML:y:ghlovk:p:r:R::t:u:V"
static void
pre_parse_args(int argc, char **argv) {
@@ -996,6 +996,11 @@ pre_parse_args(int argc, char **argv) {
isc_commandline_index = 1;
}
+static void
+version(void) {
+ fputs("nsupdate " VERSION "\n", stderr);
+}
+
static void
parse_args(int argc, char **argv, isc_mem_t *mctx, isc_entropy_t **ectx) {
int ch;
@@ -1033,6 +1038,10 @@ parse_args(int argc, char **argv, isc_mem_t *mctx, isc_entropy_t **ectx) {
case 'v':
usevc = ISC_TRUE;
break;
+ case 'V':
+ version();
+ exit(0);
+ break;
case 'k':
keyfile = isc_commandline_argument;
break;
@@ -1995,6 +2004,7 @@ do_next_command(char *cmdline) {
}
if (strcasecmp(word, "help") == 0) {
fprintf(stdout,
+"nsupdate " VERSION ":\n"
"local address [port] (set local resolver)\n"
"server address [port] (set master server for zone)\n"
"send (send the update request)\n"
@@ -2015,6 +2025,10 @@ do_next_command(char *cmdline) {
"[update] del[ete] .... (remove the given record(s) from the zone)\n");
return (STATUS_MORE);
}
+ if (strcasecmp(word, "version") == 0) {
+ fprintf(stdout, "nsupdate " VERSION "\n");
+ return (STATUS_MORE);
+ }
fprintf(stderr, "incorrect section name: %s\n", word);
return (STATUS_SYNTAX);
}
diff --git a/bin/nsupdate/nsupdate.docbook b/bin/nsupdate/nsupdate.docbook
index 7647b56b9f..cf489c8b9e 100644
--- a/bin/nsupdate/nsupdate.docbook
+++ b/bin/nsupdate/nsupdate.docbook
@@ -72,6 +72,12 @@
+<<<<<<< HEAD
+=======
+
+
+
+>>>>>>> 67d01dc... [master] add "version" options to host/nslookup/nsupdate
filename
@@ -238,6 +244,10 @@
keyboard indicates that keyboard input
should be used. This option may be specified multiple times.
+
+ The -V option causes nsupdate to print the
+ version number and exit.
+
@@ -623,6 +633,28 @@
+
+
+ version
+
+
+
+ Print version number.
+
+
+
+
+
+
+ help
+
+
+
+ Print a list of commands.
+
+
+
+