Commit 67d01dca authored by Evan Hunt's avatar Evan Hunt

[master] add "version" options to host/nslookup/nsupdate

3773.	[func]		"host", "nslookup" and "nsupdate" now have
			options and commands to print the version
                        number.  [RT #26057]
parent 6be12fa6
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]
......
......@@ -70,6 +70,7 @@
<arg><option>-p <replaceable class="parameter">port#</replaceable></option></arg>
<arg><option>-q <replaceable class="parameter">name</replaceable></option></arg>
<arg><option>-t <replaceable class="parameter">type</replaceable></option></arg>
<arg><option>-v</option></arg>
<arg><option>-x <replaceable class="parameter">addr</replaceable></option></arg>
<arg><option>-y <replaceable class="parameter"><optional>hmac:</optional>name:key</replaceable></option></arg>
<arg><option>-4</option></arg>
......@@ -285,6 +286,11 @@
<parameter>name</parameter> from other arguments.
</para>
<para>
The <option>-v</option> causes <command>dig</command> to
print the version number and exit.
</para>
<para>
Reverse lookups &mdash; mapping addresses to names &mdash; are simplified by the
<option>-x</option> option. <parameter>addr</parameter> is
......
......@@ -15,8 +15,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: host.c,v 1.127 2011/03/11 06:11:20 marka Exp $ */
/*! \file */
#include <config.h>
......@@ -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':
......
......@@ -65,6 +65,8 @@
<arg><option>-m <replaceable class="parameter">flag</replaceable></option></arg>
<arg><option>-4</option></arg>
<arg><option>-6</option></arg>
<arg><option>-v</option></arg>
<arg><option>-V</option></arg>
<arg choice="req">name</arg>
<arg choice="opt">server</arg>
</cmdsynopsis>
......@@ -238,6 +240,11 @@
<parameter>record</parameter>, <parameter>usage</parameter> and
<parameter>trace</parameter>.
</para>
<para>
The <option>-V</option> option causes <command>host</command>
to print the version number and exit.
</para>
</refsect1>
<refsect1>
......
......@@ -15,8 +15,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nslookup.c,v 1.130 2011/12/16 23:01:16 each Exp $ */
#include <config.h>
#include <stdlib.h>
......@@ -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) {
......
......@@ -230,6 +230,18 @@ nslookup -query=hinfo -timeout=10
</listitem>
</varlistentry>
<varlistentry>
<term><constant>version</constant></term>
<listitem>
<para>
Prints the version number. (This can also be
done from the command line by using
<option>-version</option>, which will print
the version number and immediately exit.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>exit</constant></term>
<listitem>
......
......@@ -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@
......
......@@ -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);
}
......
......@@ -74,6 +74,7 @@
<arg><option>-v</option></arg>
<arg><option>-T</option></arg>
<arg><option>-P</option></arg>
<arg><option>-V</option></arg>
<arg>filename</arg>
</cmdsynopsis>
</refsynopsisdiv>
......@@ -256,6 +257,10 @@
may be combined. <command>nsupdate</command> will exit after the
lists are printed.
</para>
<para>
The -V option causes <command>nsupdate</command> to print the
version number and exit.
</para>
</refsect1>
<refsect1>
......@@ -641,6 +646,28 @@
</listitem>
</varlistentry>
<varlistentry>
<term>
<command>version</command>
</term>
<listitem>
<para>
Print version number.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<command>help</command>
</term>
<listitem>
<para>
Print a list of commands.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment