conf: Fix support for --stderr as short option (-e)

I forgot --stderr could also be -e, fix handling.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2022-01-27 16:42:19 +01:00
parent 1802871e9e
commit ffc3183ac1

10
conf.c
View file

@ -766,7 +766,7 @@ void conf(struct ctx *c, int argc, char **argv)
{"debug", no_argument, NULL, 'd' }, {"debug", no_argument, NULL, 'd' },
{"quiet", no_argument, NULL, 'q' }, {"quiet", no_argument, NULL, 'q' },
{"foreground", no_argument, NULL, 'f' }, {"foreground", no_argument, NULL, 'f' },
{"stderr", no_argument, &c->stderr, 1 }, {"stderr", no_argument, NULL, 'e' },
{"help", no_argument, NULL, 'h' }, {"help", no_argument, NULL, 'h' },
{"socket", required_argument, NULL, 's' }, {"socket", required_argument, NULL, 's' },
{"ns-ifname", required_argument, NULL, 'I' }, {"ns-ifname", required_argument, NULL, 'I' },
@ -889,6 +889,14 @@ void conf(struct ctx *c, int argc, char **argv)
c->debug = 1; c->debug = 1;
c->foreground = 1; c->foreground = 1;
break; break;
case 'e':
if (c->stderr) {
err("Multiple --stderr options given");
usage(argv[0]);
}
c->stderr = 1;
break;
case 'q': case 'q':
if (c->quiet) { if (c->quiet) {
err("Multiple --quiet options given"); err("Multiple --quiet options given");