diff options
author | Karel Zak | 2017-03-06 12:09:59 +0100 |
---|---|---|
committer | Karel Zak | 2017-05-02 12:18:00 +0200 |
commit | be03f652323ce65174877fcfdd4e252b7cb17ed3 (patch) | |
tree | b28f6c4199998b66c6fb7c56a1bd1b770e19f397 /text-utils/column.c | |
parent | column: make mbs/wcs conversions more robust (diff) | |
download | kernel-qcow2-util-linux-be03f652323ce65174877fcfdd4e252b7cb17ed3.tar.gz kernel-qcow2-util-linux-be03f652323ce65174877fcfdd4e252b7cb17ed3.tar.xz kernel-qcow2-util-linux-be03f652323ce65174877fcfdd4e252b7cb17ed3.zip |
column: use err_exclusive_options()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils/column.c')
-rw-r--r-- | text-utils/column.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/text-utils/column.c b/text-utils/column.c index 14123643f..f38c6932d 100644 --- a/text-utils/column.c +++ b/text-utils/column.c @@ -51,6 +51,7 @@ #include "closestream.h" #include "ttyutils.h" #include "strv.h" +#include "optutils.h" #include "libsmartcols.h" @@ -388,7 +389,7 @@ int main(int argc, char **argv) .termwidth = 80 }; - int ch; + int c; unsigned int eval = 0; /* exit value */ static const struct option longopts[] = @@ -406,6 +407,12 @@ int main(int argc, char **argv) { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 }, }; + static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ + { 'J','x' }, + { 't','x' }, + { 0 } + }; + int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); @@ -416,8 +423,11 @@ int main(int argc, char **argv) ctl.output_separator = " "; ctl.input_separator = mbs_to_wcs("\t "); - while ((ch = getopt_long(argc, argv, "hVc:Jn:N:s:txo:", longopts, NULL)) != -1) - switch(ch) { + while ((c = getopt_long(argc, argv, "hVc:Jn:N:s:txo:", longopts, NULL)) != -1) { + + err_exclusive_options(c, longopts, excl, excl_st); + + switch(c) { case 'J': ctl.json = 1; ctl.mode = COLUMN_MODE_TABLE; @@ -453,6 +463,7 @@ int main(int argc, char **argv) break; default: errtryhelp(EXIT_FAILURE); + } } argc -= optind; argv += optind; |