From: Evan Hunt Date: Tue, 4 Mar 2014 17:49:57 +0000 (-0800) Subject: [master] rndc -q X-Git-Tag: v9.10.0b2~56 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=e7c0d42b11358f08e04316d31c67c23261dcdf36;p=thirdparty%2Fbind9.git [master] rndc -q 3776. [bug] "rndc -q" suppresses output from successful rndc commands. Errors are printed on stderr. [RT #21393] --- diff --git a/CHANGES b/CHANGES index 8cb083561f8..76ab3dfe71c 100644 --- 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] diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index f7cb8d547e8..0f728ea0670 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -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; diff --git a/bin/rndc/rndc.conf b/bin/rndc/rndc.conf index 696d54b042c..f003f142a12 100644 --- a/bin/rndc/rndc.conf +++ b/bin/rndc/rndc.conf @@ -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. */ diff --git a/bin/rndc/rndc.docbook b/bin/rndc/rndc.docbook index b8ec9ad5822..9e60a93f65d 100644 --- a/bin/rndc/rndc.docbook +++ b/bin/rndc/rndc.docbook @@ -58,6 +58,7 @@ + command @@ -164,6 +165,16 @@ + + -q + + + Quiet mode: Message text returned by the server + will not be printed except when there is an error. + + + + -V