aboutsummaryrefslogtreecommitdiff
path: root/coreutils/cut.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/cut.c')
-rw-r--r--coreutils/cut.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/coreutils/cut.c b/coreutils/cut.c
index 2d0a6237c..1e9867858 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -27,7 +27,8 @@
27//kbuild:lib-$(CONFIG_CUT) += cut.o 27//kbuild:lib-$(CONFIG_CUT) += cut.o
28 28
29//usage:#define cut_trivial_usage 29//usage:#define cut_trivial_usage
30//usage: "[OPTIONS] [FILE]..." 30//usage: "{-b|c LIST | -f"IF_FEATURE_CUT_REGEX("|F")" LIST [-d SEP] [-s]} [-D] [-O SEP] [FILE]..."
31// --output-delimiter SEP is too long to fit into 80 char-wide help ----------------^^^^^^^^
31//usage:#define cut_full_usage "\n\n" 32//usage:#define cut_full_usage "\n\n"
32//usage: "Print selected fields from FILEs to stdout\n" 33//usage: "Print selected fields from FILEs to stdout\n"
33//usage: "\n -b LIST Output only bytes from LIST" 34//usage: "\n -b LIST Output only bytes from LIST"
@@ -44,11 +45,7 @@
44//usage: "\n -s Drop lines with no delimiter (else print them in full)" 45//usage: "\n -s Drop lines with no delimiter (else print them in full)"
45//usage: "\n -D Don't sort/collate sections or match -f"IF_FEATURE_CUT_REGEX("F")" lines without delimeter" 46//usage: "\n -D Don't sort/collate sections or match -f"IF_FEATURE_CUT_REGEX("F")" lines without delimeter"
46//usage: IF_LONG_OPTS( 47//usage: IF_LONG_OPTS(
47//usage: IF_FEATURE_CUT_REGEX( 48//usage: "\n --output-delimiter SEP Output field delimeter"
48//usage: "\n --output-delimiter SEP Output field delimeter (default = -d for -f, one space for -F)"
49//usage: ) IF_NOT_FEATURE_CUT_REGEX(
50//usage: "\n --output-delimiter SEP Output field delimeter (default = -d)"
51//usage: )
52//usage: ) IF_NOT_LONG_OPTS( 49//usage: ) IF_NOT_LONG_OPTS(
53//usage: IF_FEATURE_CUT_REGEX( 50//usage: IF_FEATURE_CUT_REGEX(
54//usage: "\n -O SEP Output field delimeter (default = -d for -f, one space for -F)" 51//usage: "\n -O SEP Output field delimeter (default = -d for -f, one space for -F)"
@@ -302,7 +299,8 @@ int cut_main(int argc UNUSED_PARAM, char **argv)
302#else 299#else
303 opt = getopt32long(argv, "^" 300 opt = getopt32long(argv, "^"
304 OPT_STR // = "b:c:f:d:O:sD"IF_FEATURE_CUT_REGEX("F:")"n" 301 OPT_STR // = "b:c:f:d:O:sD"IF_FEATURE_CUT_REGEX("F:")"n"
305 "\0" "b--"ARG":c--"ARG":f--"ARG IF_FEATURE_CUT_REGEX("F--"ARG), 302 "\0" "b:c:f:"IF_FEATURE_CUT_REGEX("F:") /* one of -bcfF is required */
303 "b--"ARG":c--"ARG":f--"ARG IF_FEATURE_CUT_REGEX(":F--"ARG), /* they are mutually exclusive */
306 cut_longopts, 304 cut_longopts,
307 &sopt, &sopt, &sopt, &delim, &odelim IF_FEATURE_CUT_REGEX(, &sopt) 305 &sopt, &sopt, &sopt, &delim, &odelim IF_FEATURE_CUT_REGEX(, &sopt)
308 ); 306 );
@@ -314,8 +312,9 @@ int cut_main(int argc UNUSED_PARAM, char **argv)
314 312
315// argc -= optind; 313// argc -= optind;
316 argv += optind; 314 argv += optind;
317 if (!(opt & (OPT_BYTE | OPT_CHAR | OPT_FIELDS | OPT_REGEX))) 315 //if (!(opt & (OPT_BYTE | OPT_CHAR | OPT_FIELDS | OPT_REGEX)))
318 bb_simple_error_msg_and_die("expected a list of bytes, characters, or fields"); 316 // bb_simple_error_msg_and_die("expected a list of bytes, characters, or fields");
317 // ^^^ handled by getopt32
319 318
320 /* non-field (char or byte) cutting has some special handling */ 319 /* non-field (char or byte) cutting has some special handling */
321 if (!(opt & (OPT_FIELDS|OPT_REGEX))) { 320 if (!(opt & (OPT_FIELDS|OPT_REGEX))) {