From: Thomas Weißschuh Date: Fri, 3 Mar 2023 15:54:26 +0000 (+0000) Subject: waitpid: detect exlusive options with standard mechanism X-Git-Tag: v2.39-rc1~11^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=27376b26a2f243d202748b993088688c65c6e04a;p=thirdparty%2Futil-linux.git waitpid: detect exlusive options with standard mechanism Signed-off-by: Thomas Weißschuh --- diff --git a/misc-utils/waitpid.c b/misc-utils/waitpid.c index 871a36949e..b01a2f0131 100644 --- a/misc-utils/waitpid.c +++ b/misc-utils/waitpid.c @@ -35,6 +35,7 @@ #include "strutils.h" #include "exitcodes.h" #include "timeutils.h" +#include "optutils.h" #define EXIT_TIMEOUT_EXPIRED 3 @@ -184,8 +185,16 @@ static int parse_options(int argc, char **argv) { "help", no_argument, NULL, 'h' }, { 0 } }; + static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ + { 'c', 'e' }, + { 0 } + }; + int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT; while ((c = getopt_long (argc, argv, "vVht:c:e", longopts, NULL)) != -1) { + + err_exclusive_options(c, longopts, excl, excl_st); + switch (c) { case 'v': verbose = true; @@ -210,10 +219,6 @@ static int parse_options(int argc, char **argv) } } - if (allow_exited && count) - errx(EXIT_FAILURE, - _("-e/--exited and -c/--count are incompatible")); - return optind; }