diff options
author | Sami Kerola | 2012-06-14 21:07:28 +0200 |
---|---|---|
committer | Sami Kerola | 2012-06-17 17:59:59 +0200 |
commit | 72b99fc53ba0671c6576db8093b5255a43f3f425 (patch) | |
tree | 0b60b3ca971ab9e065469fe167b4d95a81e6340a /misc-utils/blkid.c | |
parent | hwclock: use exclusive_option() (diff) | |
download | kernel-qcow2-util-linux-72b99fc53ba0671c6576db8093b5255a43f3f425.tar.gz kernel-qcow2-util-linux-72b99fc53ba0671c6576db8093b5255a43f3f425.tar.xz kernel-qcow2-util-linux-72b99fc53ba0671c6576db8093b5255a43f3f425.zip |
blkid: use exclusive_option()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils/blkid.c')
-rw-r--r-- | misc-utils/blkid.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 840cfe4f6..579ad279f 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -44,6 +44,9 @@ extern int optind; #define STRTOXX_EXIT_CODE BLKID_EXIT_OTHER /* strtoxx_or_err() */ #include "strutils.h" +#define OPTUTILS_EXIT_CODE BLKID_EXIT_OTHER /* exclusive_option() */ +#include "optutils.h" + #include "closestream.h" #include "ttyutils.h" @@ -672,6 +675,13 @@ int main(int argc, char **argv) int c; uintmax_t offset = 0, size = 0; + enum { + EXCL_NONE, + EXCL_NAMES, + EXCL_USAGE + }; + int excl_opt = EXCL_NONE; + show[0] = NULL; atexit(close_stdout); @@ -692,17 +702,11 @@ int main(int argc, char **argv) search_type = strdup("LABEL"); break; case 'n': - if (fltr_usage) { - fprintf(stderr, "error: -u and -n options are mutually exclusive\n"); - exit(BLKID_EXIT_OTHER); - } + exclusive_option(&excl_opt, EXCL_NAMES, "-{u,n}"); fltr_type = list_to_types(optarg, &fltr_flag); break; case 'u': - if (fltr_type) { - fprintf(stderr, "error: -u and -n options are mutually exclusive\n"); - exit(BLKID_EXIT_OTHER); - } + exclusive_option(&excl_opt, EXCL_USAGE, "-{u,n}"); fltr_usage = list_to_usage(optarg, &fltr_flag); break; case 'U': |