2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Add -q (quiet) option to dnssec-signzone and dnssec-verify tool

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.
This commit is contained in:
Ondřej Surý
2019-07-22 10:33:17 -04:00
parent 94354d4655
commit fd00bac736
5 changed files with 29 additions and 14 deletions

View File

@@ -218,7 +218,6 @@ main(int argc, char **argv) {
bool unsetrev = false, unsetinact = false; bool unsetrev = false, unsetinact = false;
bool unsetdel = false; bool unsetdel = false;
bool genonly = false; bool genonly = false;
bool quiet = false;
bool show_progress = false; bool show_progress = false;
unsigned char c; unsigned char c;
isc_stdtime_t syncadd = 0, syncdel = 0; isc_stdtime_t syncadd = 0, syncdel = 0;

View File

@@ -2645,12 +2645,14 @@ loadexplicitkeys(char *keyfiles[], int n, bool setksk) {
static void static void
report(const char *format, ...) { report(const char *format, ...) {
FILE *out = output_stdout ? stderr : stdout; if (!quiet) {
va_list args; FILE *out = output_stdout ? stderr : stdout;
va_start(args, format); va_list args;
vfprintf(out, format, args); va_start(args, format);
va_end(args); vfprintf(out, format, args);
putc('\n', out); va_end(args);
putc('\n', out);
}
} }
static void static void
@@ -3086,6 +3088,7 @@ usage(void) {
fprintf(stderr, "\t-j jitter:\n"); fprintf(stderr, "\t-j jitter:\n");
fprintf(stderr, "\t\trandomize signature end time up to jitter seconds\n"); fprintf(stderr, "\t\trandomize signature end time up to jitter seconds\n");
fprintf(stderr, "\t-v debuglevel (0)\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-V:\tprint version information\n");
fprintf(stderr, "\t-o origin:\n"); fprintf(stderr, "\t-o origin:\n");
fprintf(stderr, "\t\tzone origin (name of zonefile)\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"); fatal("verbose level must be numeric");
break; break;
case 'q':
quiet = true;
break;
case 'X': case 'X':
dnskey_endstr = isc_commandline_argument; dnskey_endstr = isc_commandline_argument;
break; break;

View File

@@ -80,11 +80,13 @@ static bool keyset_kskonly = false;
static void static void
report(const char *format, ...) { report(const char *format, ...) {
va_list args; if (!quiet) {
va_start(args, format); va_list args;
vfprintf(stdout, format, args); va_start(args, format);
va_end(args); vfprintf(stdout, format, args);
putc('\n', stdout); va_end(args);
putc('\n', stdout);
}
} }
/*% /*%
@@ -149,6 +151,7 @@ usage(void) {
fprintf(stderr, "Options: (default value in parenthesis) \n"); fprintf(stderr, "Options: (default value in parenthesis) \n");
fprintf(stderr, "\t-v debuglevel (0)\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-V:\tprint version information\n");
fprintf(stderr, "\t-o origin:\n"); fprintf(stderr, "\t-o origin:\n");
fprintf(stderr, "\t\tzone origin (name of zonefile)\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"); fatal("verbose level must be numeric");
break; break;
case 'q':
quiet = true;
break;
case 'x': case 'x':
keyset_kskonly = true; keyset_kskonly = true;
break; break;

View File

@@ -57,7 +57,8 @@
#include "dnssectool.h" #include "dnssectool.h"
int verbose; int verbose = 0;
bool quiet = false;
uint8_t dtype[8]; uint8_t dtype[8];
static fatalcallback_t *fatalcallback = NULL; static fatalcallback_t *fatalcallback = NULL;

View File

@@ -25,8 +25,9 @@
#define PATH_MAX 1024 /* WIN32, and others don't define this. */ #define PATH_MAX 1024 /* WIN32, and others don't define this. */
#endif #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 int verbose;
extern bool quiet;
/*! program name, statically initialized in each program */ /*! program name, statically initialized in each program */
extern const char *program; extern const char *program;