]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] add "version" options to host/nslookup/nsupdate
authorEvan Hunt <each@isc.org>
Mon, 3 Mar 2014 16:46:50 +0000 (08:46 -0800)
committerEvan Hunt <each@isc.org>
Mon, 3 Mar 2014 17:08:04 +0000 (09:08 -0800)
3773. [func] "host", "nslookup" and "nsupdate" now have
options and commands to print the version
                        number.  [RT #26057]

CHANGES
bin/dig/dig.docbook
bin/dig/host.c
bin/dig/host.docbook
bin/dig/nslookup.c
bin/dig/nslookup.docbook
bin/nsupdate/Makefile.in
bin/nsupdate/nsupdate.c
bin/nsupdate/nsupdate.docbook

diff --git a/CHANGES b/CHANGES
index 72e649c6a54b228a8ebecdd166c15f6095094314..f7d94c7a8bdc201f6bb14ee87cd828dc18e689cc 100644 (file)
--- 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]
index bb2f4aa44229ae5af6e47d945326f98258765ff4..999a5609a47c21a697602a4e55f341e99d9aa7f5 100644 (file)
@@ -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>
       <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
index d1392fc8460bf750c9ef646b265087f73ff0a2c1..e3e13b73dfdb825d2cc3975bc250f9729b3ed5a8 100644 (file)
@@ -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':
index f5ccd6eeb4440b0e5f61189ef03f12360b26b5fd..30fc441044efb8ea738836b5a3941378621e1ead 100644 (file)
@@ -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>
       <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>
index 6c2f0a949983e1dd07add4b7bbf34bc13b5554fa..3e709af160fc5903db58f91096020f85c50d9d16 100644 (file)
@@ -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) {
index c757bcd34d4696de8ba51dce9230c778d32c5045..88d3d6a2e59e2b0bc9f12cc904be4c6b2cb9fa58 100644 (file)
@@ -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>
index 6546e9c7cc76e8e5c492f461b68822de3d910426..5dc20ad90714dcb6eca72ae83261586a16eb4162 100644 (file)
@@ -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@
index 219f6281b63f260617af5b697942ee39299480c5..d534cff96673ce64a8f1e9a4d95d343db539f2fa 100644 (file)
@@ -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);
 }
index d4334e6bf5044bc25a1152094c81d74c08f92bc0..a2156beb9aca7f7c27182ce4ac42cf81f50f2d17 100644 (file)
@@ -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>
       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>
           </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>