summaryrefslogtreecommitdiffstats
path: root/disk-utils/partx.c
diff options
context:
space:
mode:
authorKarel Zak2012-07-26 09:23:40 +0200
committerKarel Zak2012-07-26 09:23:40 +0200
commita29627cb29e2a0cb93f83146747a77025e05558d (patch)
tree24471b1678d890a45015fc77217ba4232b4c6495 /disk-utils/partx.c
parentinclude/optutils: add err_exclusive_options() (diff)
downloadkernel-qcow2-util-linux-a29627cb29e2a0cb93f83146747a77025e05558d.tar.gz
kernel-qcow2-util-linux-a29627cb29e2a0cb93f83146747a77025e05558d.tar.xz
kernel-qcow2-util-linux-a29627cb29e2a0cb93f83146747a77025e05558d.zip
partx: use err_exclusive_options()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/partx.c')
-rw-r--r--disk-utils/partx.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/disk-utils/partx.c b/disk-utils/partx.c
index 69c559dea..923ca98b0 100644
--- a/disk-utils/partx.c
+++ b/disk-utils/partx.c
@@ -663,6 +663,12 @@ int main(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
+ static const ul_excl_t excl[] = { /* rows and cols in in ASCII order */
+ { 'P','a','d','l','r','s' },
+ { 0 }
+ };
+ int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;
+
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
@@ -670,21 +676,24 @@ int main(int argc, char **argv)
while ((c = getopt_long(argc, argv,
"abdglrsvn:t:o:PhV", long_opts, NULL)) != -1) {
+
+ err_exclusive_options(c, long_opts, excl, excl_st);
+
switch(c) {
case 'a':
- exclusive_option(&what, ACT_ADD, ACT_ERROR);
+ what = ACT_ADD;
break;
case 'b':
partx_flags |= FL_BYTES;
break;
case 'd':
- exclusive_option(&what, ACT_DELETE, ACT_ERROR);
+ what = ACT_DELETE;
break;
case 'g':
tt_flags |= TT_FL_NOHEADINGS;
break;
case 'l':
- exclusive_option(&what, ACT_LIST, ACT_ERROR);
+ what = ACT_LIST;
break;
case 'n':
if (parse_range(optarg, &lower, &upper, 0))
@@ -696,18 +705,17 @@ int main(int argc, char **argv)
column_name_to_id);
if (ncolumns < 0)
return EXIT_FAILURE;
- exclusive_option(&what, ACT_SHOW, ACT_ERROR);
break;
case 'P':
tt_flags |= TT_FL_EXPORT;
- exclusive_option(&what, ACT_SHOW, ACT_ERROR);
+ what = ACT_SHOW;
break;
case 'r':
tt_flags |= TT_FL_RAW;
- exclusive_option(&what, ACT_SHOW, ACT_ERROR);
+ what = ACT_SHOW;
break;
case 's':
- exclusive_option(&what, ACT_SHOW, ACT_ERROR);
+ what = ACT_SHOW;
break;
case 't':
type = optarg;