From a8e458b9712d1efafca44614e38223eaf16a6380 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 26 Jul 2012 09:23:58 +0200 Subject: [PATCH] blkid: use err_exclusive_options() Signed-off-by: Karel Zak --- misc-utils/blkid.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 579ad279fa..e47a79381a 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 */ -- 2.39.5