]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add -q (quiet) option to dnssec-signzone and dnssec-verify tool
authorOndřej Surý <ondrej@sury.org>
Mon, 22 Jul 2019 14:33:17 +0000 (10:33 -0400)
committerOndřej Surý <ondrej@sury.org>
Wed, 31 Jul 2019 08:05:52 +0000 (10:05 +0200)
With the move of the normal output to stdout, we need a way how to silence the
extra output, so the signed file name can be captured in a simple way.  This
commit adds `-q` command line option that will silence all the normal output
that get's printed from both tools.

bin/dnssec/dnssec-keygen.c
bin/dnssec/dnssec-signzone.c
bin/dnssec/dnssec-verify.c
bin/dnssec/dnssectool.c
bin/dnssec/dnssectool.h

index be6779ca1dd97401f86c1bb6fff1fde87ed52c6f..2fad3fb285cb0a8b768f5b7b9d42986c87bea851 100644 (file)
@@ -218,7 +218,6 @@ main(int argc, char **argv) {
        bool    unsetrev = false, unsetinact = false;
        bool    unsetdel = false;
        bool    genonly = false;
-       bool    quiet = false;
        bool    show_progress = false;
        unsigned char   c;
        isc_stdtime_t   syncadd = 0, syncdel = 0;
index 7a0155baa5550f50b58b61c076bb7ae99f46a015..8b5e4c34a5a97666aeea48f140b27abc3417dbe4 100644 (file)
@@ -2645,12 +2645,14 @@ loadexplicitkeys(char *keyfiles[], int n, bool setksk) {
 
 static void
 report(const char *format, ...) {
-       FILE *out = output_stdout ? stderr : stdout;
-       va_list args;
-       va_start(args, format);
-       vfprintf(out, format, args);
-       va_end(args);
-       putc('\n', out);
+       if (!quiet) {
+               FILE *out = output_stdout ? stderr : stdout;
+               va_list args;
+               va_start(args, format);
+               vfprintf(out, format, args);
+               va_end(args);
+               putc('\n', out);
+       }
 }
 
 static void
@@ -3086,6 +3088,7 @@ usage(void) {
        fprintf(stderr, "\t-j jitter:\n");
        fprintf(stderr, "\t\trandomize signature end time up to jitter seconds\n");
        fprintf(stderr, "\t-v debuglevel (0)\n");
+       fprintf(stderr, "\t-q quiet\n");
        fprintf(stderr, "\t-V:\tprint version information\n");
        fprintf(stderr, "\t-o origin:\n");
        fprintf(stderr, "\t\tzone origin (name of zonefile)\n");
@@ -3479,6 +3482,10 @@ main(int argc, char *argv[]) {
                                fatal("verbose level must be numeric");
                        break;
 
+               case 'q':
+                       quiet = true;
+                       break;
+
                case 'X':
                        dnskey_endstr = isc_commandline_argument;
                        break;
index caf97426950b6200de5b63bf85cb605437751ea3..7fff0df94ec734d96948f249091408e32aaa10ac 100644 (file)
@@ -80,11 +80,13 @@ static bool keyset_kskonly = false;
 
 static void
 report(const char *format, ...) {
-       va_list args;
-       va_start(args, format);
-       vfprintf(stdout, format, args);
-       va_end(args);
-       putc('\n', stdout);
+       if (!quiet) {
+               va_list args;
+               va_start(args, format);
+               vfprintf(stdout, format, args);
+               va_end(args);
+               putc('\n', stdout);
+       }
 }
 
 /*%
@@ -149,6 +151,7 @@ usage(void) {
 
        fprintf(stderr, "Options: (default value in parenthesis) \n");
        fprintf(stderr, "\t-v debuglevel (0)\n");
+       fprintf(stderr, "\t-q quiet\n");
        fprintf(stderr, "\t-V:\tprint version information\n");
        fprintf(stderr, "\t-o origin:\n");
        fprintf(stderr, "\t\tzone origin (name of zonefile)\n");
@@ -246,6 +249,10 @@ main(int argc, char *argv[]) {
                                fatal("verbose level must be numeric");
                        break;
 
+               case 'q':
+                       quiet = true;
+                       break;
+
                case 'x':
                        keyset_kskonly = true;
                        break;
index e1205d05f88ad8c7d52c701e11bf5ad386211d5e..5ba2cc12663bbec3bcd1ac64b130c4e06f3fb54a 100644 (file)
@@ -57,7 +57,8 @@
 
 #include "dnssectool.h"
 
-int verbose;
+int verbose = 0;
+bool quiet = false;
 uint8_t dtype[8];
 
 static fatalcallback_t *fatalcallback = NULL;
index e4798e8336b9916430fa06c182987891bafb0d22..cddfb2f902b1b259a2bb5c16b83772ee57465e16 100644 (file)
@@ -25,8 +25,9 @@
 #define PATH_MAX 1024   /* WIN32, and others don't define this. */
 #endif
 
-/*! verbosity: set by -v option in each program, defined in dnssectool.c */
+/*! verbosity: set by -v and -q option in each program, defined in dnssectool.c */
 extern int verbose;
+extern bool quiet;
 
 /*! program name, statically initialized in each program */
 extern const char *program;