mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-12 13:59:59 -04:00
[v9_9] add "version" options to host/nslookup/nsupdate
3773. [func] "host", "nslookup" and "nsupdate" now have
options to print the version number and exit.
[RT #26057]
This commit is contained in:
parent
48f5fe9716
commit
d4600129e6
9 changed files with 93 additions and 10 deletions
4
CHANGES
4
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]
|
||||
|
|
|
|||
|
|
@ -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 — mapping addresses to names — 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) {
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -133,6 +133,11 @@ nslookup -query=hinfo -timeout=10
|
|||
</programlisting>
|
||||
<!-- </informalexample> -->
|
||||
</para>
|
||||
<para>
|
||||
The <option>-version</option> option causes
|
||||
<command>nslookup</command> to print the version
|
||||
number and immediately exits.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
|
|
|
|||
|
|
@ -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: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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,12 @@
|
|||
<arg><option>-r <replaceable class="parameter">udpretries</replaceable></option></arg>
|
||||
<arg><option>-R <replaceable class="parameter">randomdev</replaceable></option></arg>
|
||||
<arg><option>-v</option></arg>
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<arg><option>-T</option></arg>
|
||||
<arg><option>-P</option></arg>
|
||||
<arg><option>-V</option></arg>
|
||||
>>>>>>> 67d01dc... [master] add "version" options to host/nslookup/nsupdate
|
||||
<arg>filename</arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
|
@ -238,6 +244,10 @@
|
|||
<filename>keyboard</filename> indicates that keyboard input
|
||||
should be used. This option may be specified multiple times.
|
||||
</para>
|
||||
<para>
|
||||
The -V option causes <command>nsupdate</command> to print the
|
||||
version number and exit.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
|
|
@ -623,6 +633,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>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue