]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
blkid: use err_exclusive_options()
authorKarel Zak <kzak@redhat.com>
Thu, 26 Jul 2012 07:23:58 +0000 (09:23 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 26 Jul 2012 07:23:58 +0000 (09:23 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/blkid.c

index 579ad279fa398399903eaeeb1cccd60e7039dcc2..e47a79381a5044bf537a5ec723b5e45306795193 100644 (file)
@@ -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 */