diff --git a/CHANGES b/CHANGES
index 72e649c6a5..f7d94c7a8b 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]
+
3772. [contrib] Added sqlite3 dynamically-loadable DLZ module.
(Based in part on a contribution from Tim Tessier.)
[RT #20822]
diff --git a/bin/dig/dig.docbook b/bin/dig/dig.docbook
index bb2f4aa442..999a5609a4 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..3e709af160 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) {
@@ -751,6 +754,8 @@ do_next_command(char *input) {
show_settings(ISC_TRUE, ISC_TRUE);
} else if (strcasecmp(ptr, "exit") == 0) {
in_use = ISC_FALSE;
+ } else if (strncasecmp(ptr, "ver", 3) == 0) {
+ version();
} else if (strcasecmp(ptr, "help") == 0 ||
strcasecmp(ptr, "?") == 0) {
printf("The '%s' command is not yet implemented.\n", ptr);
@@ -805,9 +810,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..88d3d6a2e5 100644
--- a/bin/dig/nslookup.docbook
+++ b/bin/dig/nslookup.docbook
@@ -230,6 +230,18 @@ nslookup -query=hinfo -timeout=10
+
+ version
+
+
+ Prints the version number. (This can also be
+ done from the command line by using
+ , which will print
+ the version number and immediately exit.)
+
+
+
+
exit
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 219f6281b6..d534cff966 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:Pr:R::t:Tu:"
+#define PARSE_ARGS_FMT "dDML:y:ghlovk:p:Pr:R::t:Tu:V"
static void
pre_parse_args(int argc, char **argv) {
@@ -1023,6 +1023,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;
@@ -1060,6 +1065,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;
@@ -2022,6 +2031,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"
@@ -2042,6 +2052,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 d4334e6bf5..a2156beb9a 100644
--- a/bin/nsupdate/nsupdate.docbook
+++ b/bin/nsupdate/nsupdate.docbook
@@ -74,6 +74,7 @@
+
filename
@@ -256,6 +257,10 @@
may be combined. nsupdate will exit after the
lists are printed.
+
+ The -V option causes nsupdate to print the
+ version number and exit.
+
@@ -641,6 +646,28 @@
+
+
+ version
+
+
+
+ Print version number.
+
+
+
+
+
+
+ help
+
+
+
+ Print a list of commands.
+
+
+
+