From: Karel Zak Date: Wed, 23 Aug 2023 09:36:45 +0000 (+0200) Subject: uuidgen: mark some options mutually exclusive X-Git-Tag: v2.40-rc1~261^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28387664019c17cf69324e4f29711018422c4e07;p=thirdparty%2Futil-linux.git uuidgen: mark some options mutually exclusive * types cannot be mixed (--time, --random, --md5 and --sha1) * --count makes sense only for --time and --random * --name and --namespace makes sense only for --md5 and --sha1 Signed-off-by: Karel Zak --- diff --git a/misc-utils/uuidgen.c b/misc-utils/uuidgen.c index 5af35ff96d..ee1235d32f 100644 --- a/misc-utils/uuidgen.c +++ b/misc-utils/uuidgen.c @@ -18,6 +18,7 @@ #include "c.h" #include "closestream.h" #include "strutils.h" +#include "optutils.h" static void __attribute__((__noreturn__)) usage(void) { @@ -106,12 +107,24 @@ main (int argc, char *argv[]) {NULL, 0, NULL, 0} }; + static const ul_excl_t excl[] = { + { 'C', 'm', 's' }, + { 'N', 'r', 't' }, + { 'm', 'r', 's', 't' }, + { 'n', 'r', 't' }, + { 0 } + }; + int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT; + setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); close_stdout_atexit(); while ((c = getopt_long(argc, argv, "C:rtVhn:N:msx", longopts, NULL)) != -1) { + + err_exclusive_options(c, longopts, excl, excl_st); + switch (c) { case 't': do_type = UUID_TYPE_DCE_TIME;