diff options
author | Sami Kerola | 2012-06-15 23:54:41 +0200 |
---|---|---|
committer | Sami Kerola | 2012-06-17 17:59:59 +0200 |
commit | e6dbcc4a2005a889a9405b2da279de5564661c7e (patch) | |
tree | b1493e3d16d953e654efab9994766551495f3d84 /sys-utils/wdctl.c | |
parent | prlimit: use exclusive_option() (diff) | |
download | kernel-qcow2-util-linux-e6dbcc4a2005a889a9405b2da279de5564661c7e.tar.gz kernel-qcow2-util-linux-e6dbcc4a2005a889a9405b2da279de5564661c7e.tar.xz kernel-qcow2-util-linux-e6dbcc4a2005a889a9405b2da279de5564661c7e.zip |
wdctl: use exclusive_option()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/wdctl.c')
-rw-r--r-- | sys-utils/wdctl.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c index 2c9ca2722..c18f7fc38 100644 --- a/sys-utils/wdctl.c +++ b/sys-utils/wdctl.c @@ -29,6 +29,7 @@ #include "nls.h" #include "c.h" #include "closestream.h" +#include "optutils.h" #include "pathnames.h" #include "strutils.h" #include "tt.h" @@ -381,6 +382,13 @@ int main(int argc, char *argv[]) char noflags = 0, noident = 0, notimeouts = 0, oneline = 0; uint32_t wanted = 0; + enum { + EXCL_NONE, + EXCL_FLAGS, + EXCL_NOFLAGS + }; + int excl_flag = EXCL_NONE; + static const struct option long_opts[] = { { "flags", required_argument, NULL, 'f' }, { "flags-only", no_argument, NULL, 'x' }, @@ -412,6 +420,7 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; break; case 'f': + exclusive_option(&excl_flag, EXCL_FLAGS, "--{flags,noflags}"); if (string_to_bitmask(optarg, (unsigned long *) &wanted, name2bit) != 0) return EXIT_FAILURE; break; @@ -421,6 +430,7 @@ int main(int argc, char *argv[]) case 'h': usage(stdout); case 'F': + exclusive_option(&excl_flag, EXCL_NOFLAGS, "--{flags,noflags}"); noflags = 1; break; case 'I': @@ -449,9 +459,6 @@ int main(int argc, char *argv[]) } } - if (wanted && noflags) - errx(EXIT_FAILURE, _("--flags and --noflags are mutually exclusive")); - if (!ncolumns) { /* default columns */ columns[ncolumns++] = COL_FLAG; |