diff options
author | Sami Kerola | 2014-05-24 18:58:05 +0200 |
---|---|---|
committer | Sami Kerola | 2014-05-26 17:42:40 +0200 |
commit | e4faf6484719061f41624d135beb93ca821045c6 (patch) | |
tree | 5df23885bffedc51fc72caffa68d549036728f35 /misc-utils/uuidd.c | |
parent | uuidd: ensure pid file is wrote when it is requested (diff) | |
download | kernel-qcow2-util-linux-e4faf6484719061f41624d135beb93ca821045c6.tar.gz kernel-qcow2-util-linux-e4faf6484719061f41624d135beb93ca821045c6.tar.xz kernel-qcow2-util-linux-e4faf6484719061f41624d135beb93ca821045c6.zip |
uuidd: set options to be mutually exclusive
--pid || --no-pid
--debug || --quiet
--random || --time
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils/uuidd.c')
-rw-r--r-- | misc-utils/uuidd.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c index 57309193f..f72c45281 100644 --- a/misc-utils/uuidd.c +++ b/misc-utils/uuidd.c @@ -37,6 +37,7 @@ extern int optind; #include "c.h" #include "closestream.h" #include "strutils.h" +#include "optutils.h" #ifdef HAVE_LIBSYSTEMD # include <systemd/sd-daemon.h> @@ -510,6 +511,13 @@ int main(int argc, char **argv) {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0} }; + static const ul_excl_t excl[] = { + { 'P', 'p' }, + { 'd', 'q' }, + { 'r', 't' }, + { 0 } + }; + int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); @@ -519,6 +527,7 @@ int main(int argc, char **argv) while ((c = getopt_long(argc, argv, "p:s:T:krtn:PFSdqVh", longopts, NULL)) != -1) { + err_exclusive_options(c, longopts, excl, excl_st); switch (c) { case 'd': uuidd_cxt.debug = 1; @@ -576,9 +585,6 @@ int main(int argc, char **argv) } } - if (no_pid && pidfile_path_param && !uuidd_cxt.quiet) - warnx(_("Both --pid and --no-pid specified. Ignoring --no-pid.")); - if (!no_pid && !pidfile_path_param) pidfile_path = UUIDD_PIDFILE_PATH; else if (pidfile_path_param) |