2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +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 unsetdel = false;
bool genonly = false;
bool quiet = false;
bool show_progress = false;
unsigned char c;
isc_stdtime_t syncadd = 0, syncdel = 0;

View 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;

View 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;

View 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;

View 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;