diff options
author | Karel Zak | 2012-07-26 09:23:58 +0200 |
---|---|---|
committer | Karel Zak | 2012-07-26 09:23:58 +0200 |
commit | a8e458b9712d1efafca44614e38223eaf16a6380 (patch) | |
tree | 1bd6ca0f5b875baf4cbd82b7a65ce814601f6342 /misc-utils/blkid.c | |
parent | partx: use err_exclusive_options() (diff) | |
download | kernel-qcow2-util-linux-a8e458b9712d1efafca44614e38223eaf16a6380.tar.gz kernel-qcow2-util-linux-a8e458b9712d1efafca44614e38223eaf16a6380.tar.xz kernel-qcow2-util-linux-a8e458b9712d1efafca44614e38223eaf16a6380.zip |
blkid: use err_exclusive_options()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/blkid.c')
-rw-r--r-- | misc-utils/blkid.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 579ad279f..e47a79381 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -675,17 +675,20 @@ int main(int argc, char **argv) int c; uintmax_t offset = 0, size = 0; - enum { - EXCL_NONE, - EXCL_NAMES, - EXCL_USAGE + static const ul_excl_t excl[] = { /* rows and cols in in ASCII order */ + { 'n','u' }, + { 0 } }; - int excl_opt = EXCL_NONE; + int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT; show[0] = NULL; atexit(close_stdout); - while ((c = getopt (argc, argv, "c:df:ghilL:n:ko:O:ps:S:t:u:U:w:v")) != EOF) + while ((c = getopt (argc, argv, + "c:df:ghilL:n:ko:O:ps:S:t:u:U:w:v")) != EOF) { + + err_exclusive_options(c, NULL, excl, excl_st); + switch (c) { case 'c': if (optarg && !*optarg) @@ -702,11 +705,9 @@ int main(int argc, char **argv) search_type = strdup("LABEL"); break; case 'n': - exclusive_option(&excl_opt, EXCL_NAMES, "-{u,n}"); fltr_type = list_to_types(optarg, &fltr_flag); break; case 'u': - exclusive_option(&excl_opt, EXCL_USAGE, "-{u,n}"); fltr_usage = list_to_usage(optarg, &fltr_flag); break; case 'U': @@ -794,6 +795,7 @@ int main(int argc, char **argv) default: usage(err); } + } /* The rest of the args are device names */ |