From: Vladimír Čunát Date: Thu, 9 Jan 2020 13:47:04 +0000 (+0100) Subject: main: add --noninteractive command-line option X-Git-Tag: v5.0.0~5^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bae63ec644c8b03f6a1bd72da8000ea9336a37eb;p=thirdparty%2Fknot-resolver.git main: add --noninteractive command-line option --- diff --git a/daemon/main.c b/daemon/main.c index 3752e6700..d47e8a535 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -232,7 +232,8 @@ static void help(int argc, char *argv[]) " -t, --tls=[addr] Server address for TLS (default: off).\n" " -S, --fd=[fd:kind] Listen on given fd (handed out by supervisor, :kind is optional).\n" " -c, --config=[path] Config file path (relative to [rundir]) (default: config).\n" - " -f, --forks=N Start N forks sharing the configuration.\n" + " -f, --forks=N Start N forks sharing the configuration (implies -n).\n" + " -n, --noninteractive Don't start the read-eval-print loop for stdin+stdout.\n" " -q, --quiet No command prompt in interactive mode.\n" " -v, --verbose Run in verbose mode." #ifdef NOVERBOSELOG @@ -356,13 +357,14 @@ static int parse_args(int argc, char **argv, struct args *args) {"fd", required_argument, 0, 'S'}, {"config", required_argument, 0, 'c'}, {"forks", required_argument, 0, 'f'}, + {"noninteractive", no_argument, 0, 'n'}, {"verbose", no_argument, 0, 'v'}, {"quiet", no_argument, 0, 'q'}, {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; - while ((c = getopt_long(argc, argv, "a:t:S:c:f:m:K:k:vqVh", opts, &li)) != -1) { + while ((c = getopt_long(argc, argv, "a:t:S:c:f:nm:K:k:vqVh", opts, &li)) != -1) { switch (c) { case 'a': @@ -376,13 +378,15 @@ static int parse_args(int argc, char **argv, struct args *args) array_push(args->config, optarg); break; case 'f': - args->interactive = false; args->forks = strtol_10(optarg); if (args->forks <= 0) { kr_log_error("[system] error '-f' requires a positive" " number, not '%s'\n", optarg); return EXIT_FAILURE; } + /* fall through */ + case 'n': + args->interactive = false; break; case 'v': kr_verbose_set(true); diff --git a/doc/kresd.8.in b/doc/kresd.8.in index 8bd87fc9e..68cedc12a 100644 --- a/doc/kresd.8.in +++ b/doc/kresd.8.in @@ -24,6 +24,7 @@ .IR config ] .RB [ \-f | \-\-forks .IR N ] +.RB [ \-n | \-\-noninteractive ] .RB [ \-q | \-\-quiet ] .RB [ \-v | \-\-verbose ] .RB [ \-V | \-\-version ] @@ -127,6 +128,9 @@ When socket-activated and supervised by systemd or the equivalent, kresd default processes supervised in this way, they should be supervised independently (see \fBkresd.systemd(7)\fR). .TP +.B \-n\fR, \fB\-\-noninteractive +Daemon will refrain from entering into read-eval-print loop for stdin+stdout. +.TP .B \-q\fR, \fB\-\-quiet Daemon will refrain from printing the command prompt. .TP