]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
main: add --noninteractive command-line option
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 9 Jan 2020 13:47:04 +0000 (14:47 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 17 Jan 2020 14:01:41 +0000 (15:01 +0100)
daemon/main.c
doc/kresd.8.in

index 3752e6700fc046fd4a45973ab3454b559c34a92e..d47e8a53555ee1c27f21936c27907e60a21cdff7 100644 (file)
@@ -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);
index 8bd87fc9e4fb9898c2760d92d35007733e841ad8..68cedc12a20a14b206c504a02ed0d3ce9cf2b40e 100644 (file)
@@ -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