]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] rndc -q
authorEvan Hunt <each@isc.org>
Tue, 4 Mar 2014 17:49:57 +0000 (09:49 -0800)
committerEvan Hunt <each@isc.org>
Tue, 4 Mar 2014 17:49:57 +0000 (09:49 -0800)
3776. [bug] "rndc -q" suppresses output from successful
rndc commands. Errors are printed on stderr.
                        [RT #21393]

CHANGES
bin/rndc/rndc.c
bin/rndc/rndc.conf
bin/rndc/rndc.docbook

diff --git a/CHANGES b/CHANGES
index 8cb083561f8eb3b7292a416995a52f113c32fbea..76ab3dfe71cd5131466d6e4f7eec246e0d82433d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+3776.  [bug]           "rndc -q" suppresses output from successful
+                       rndc commands. Errors are printed on stderr.
+                        [RT #21393]
+
 3775.  [bug]           dlz_dlopen driver could return the wrong error
                        code on API version mismatch, leading to a segfault.
                        [RT #35495]
index f7cb8d547e8194d9ee29d3a5e9a72d599abb2b32..0f728ea0670980b43c0633c4ebf6830bd353645c 100644 (file)
@@ -15,8 +15,6 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rndc.c,v 1.142 2012/02/03 22:27:17 each Exp $ */
-
 /*! \file */
 
 /*
@@ -88,6 +86,7 @@ static char *args;
 static char program[256];
 static isc_socket_t *sock = NULL;
 static isc_uint32_t serial;
+static isc_boolean_t quiet = ISC_FALSE;
 
 static void rndc_startconnect(isc_sockaddr_t *addr, isc_task_t *task);
 
@@ -271,8 +270,8 @@ rndc_recvdone(isc_task_t *task, isc_event_t *event) {
 
        result = isccc_cc_lookupstring(data, "text", &textmsg);
        if (result == ISC_R_SUCCESS) {
-               if (strlen(textmsg) != 0U)
-                       printf("%s\n", textmsg);
+               if ((!quiet || failed) && strlen(textmsg) != 0U)
+                       fprintf(failed ? stderr : stdout, "%s\n", textmsg);
        } else if (result != ISC_R_NOTFOUND)
                fprintf(stderr, "%s: parsing response failed: %s\n",
                        progname, isc_result_totext(result));
@@ -727,8 +726,8 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
 
 int
 main(int argc, char **argv) {
-       isc_boolean_t show_final_mem = ISC_FALSE;
        isc_result_t result = ISC_R_SUCCESS;
+       isc_boolean_t show_final_mem = ISC_FALSE;
        isc_taskmgr_t *taskmgr = NULL;
        isc_task_t *task = NULL;
        isc_log_t *log = NULL;
@@ -761,7 +760,7 @@ main(int argc, char **argv) {
 
        isc_commandline_errprint = ISC_FALSE;
 
-       while ((ch = isc_commandline_parse(argc, argv, "b:c:hk:Mmp:s:Vy:"))
+       while ((ch = isc_commandline_parse(argc, argv, "b:c:hk:Mmp:qs:Vy:"))
               != -1) {
                switch (ch) {
                case 'b':
@@ -800,6 +799,10 @@ main(int argc, char **argv) {
                                      isc_commandline_argument);
                        break;
 
+               case 'q':
+                       quiet = ISC_TRUE;
+                       break;
+
                case 's':
                        servername = isc_commandline_argument;
                        break;
index 696d54b042c23f3283df8ac48451cbc9ae3278e3..f003f142a12b839d60743ced0239192de0e7e6e4 100644 (file)
@@ -15,8 +15,6 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rndc.conf,v 1.11 2007/06/19 23:46:59 tbox Exp $ */
-
 /*
  * Sample rndc configuration file.
  */
index b8ec9ad58225b43cf76eaac13c65e4079785d7e3..9e60a93f65d6e72b32fbd32ddabeb81b3b3ec2b8 100644 (file)
@@ -58,6 +58,7 @@
       <arg><option>-k <replaceable class="parameter">key-file</replaceable></option></arg>
       <arg><option>-s <replaceable class="parameter">server</replaceable></option></arg>
       <arg><option>-p <replaceable class="parameter">port</replaceable></option></arg>
+      <arg><option>-a</option></arg>
       <arg><option>-V</option></arg>
       <arg><option>-y <replaceable class="parameter">key_id</replaceable></option></arg>
       <arg choice="req">command</arg>
         </listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term>-q</term>
+        <listitem>
+          <para>
+            Quiet mode: Message text returned by the server
+            will not be printed except when there is an error.
+          </para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry>
         <term>-V</term>
         <listitem>