← Commit list

a4894eaf7

Denys Vlasenko
Denys Vlasenko
2024-12-11
SUCCESS Duration: 158s

Subject

cut: tweak --help

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

coreutils/cut.c+8 -9
@@ -27,7 +27,8 @@
//kbuild:lib-$(CONFIG_CUT) += cut.o
//usage:#define cut_trivial_usage
-//usage: "[OPTIONS] [FILE]..."
+//usage: "{-b|c LIST | -f"IF_FEATURE_CUT_REGEX("|F")" LIST [-d SEP] [-s]} [-D] [-O SEP] [FILE]..."
+// --output-delimiter SEP is too long to fit into 80 char-wide help ----------------^^^^^^^^
//usage:#define cut_full_usage "\n\n"
//usage: "Print selected fields from FILEs to stdout\n"
//usage: "\n -b LIST Output only bytes from LIST"
@@ -44,11 +45,7 @@
//usage: "\n -s Drop lines with no delimiter (else print them in full)"
//usage: "\n -D Don't sort/collate sections or match -f"IF_FEATURE_CUT_REGEX("F")" lines without delimeter"
//usage: IF_LONG_OPTS(
-//usage: IF_FEATURE_CUT_REGEX(
-//usage: "\n --output-delimiter SEP Output field delimeter (default = -d for -f, one space for -F)"
-//usage: ) IF_NOT_FEATURE_CUT_REGEX(
-//usage: "\n --output-delimiter SEP Output field delimeter (default = -d)"
-//usage: )
+//usage: "\n --output-delimiter SEP Output field delimeter"
//usage: ) IF_NOT_LONG_OPTS(
//usage: IF_FEATURE_CUT_REGEX(
//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)
#else
opt = getopt32long(argv, "^"
OPT_STR // = "b:c:f:d:O:sD"IF_FEATURE_CUT_REGEX("F:")"n"
- "\0" "b--"ARG":c--"ARG":f--"ARG IF_FEATURE_CUT_REGEX("F--"ARG),
+ "\0" "b:c:f:"IF_FEATURE_CUT_REGEX("F:") /* one of -bcfF is required */
+ "b--"ARG":c--"ARG":f--"ARG IF_FEATURE_CUT_REGEX(":F--"ARG), /* they are mutually exclusive */
cut_longopts,
&sopt, &sopt, &sopt, &delim, &odelim IF_FEATURE_CUT_REGEX(, &sopt)
);
@@ -314,8 +312,9 @@ int cut_main(int argc UNUSED_PARAM, char **argv)
// argc -= optind;
argv += optind;
- if (!(opt & (OPT_BYTE | OPT_CHAR | OPT_FIELDS | OPT_REGEX)))
- bb_simple_error_msg_and_die("expected a list of bytes, characters, or fields");
+ //if (!(opt & (OPT_BYTE | OPT_CHAR | OPT_FIELDS | OPT_REGEX)))
+ // bb_simple_error_msg_and_die("expected a list of bytes, characters, or fields");
+ // ^^^ handled by getopt32
/* non-field (char or byte) cutting has some special handling */
if (!(opt & (OPT_FIELDS|OPT_REGEX))) {
libbb/getopt32.c+2 -2
@@ -93,7 +93,7 @@ getopt32(char **argv, const char *applet_opts, ...)
"!" If the first character in the applet_opts string is a '!',
report bad options, missing required options,
- inconsistent options with all-ones return value (instead of abort.
+ inconsistent options with all-ones return value instead of aborting.
"+" If the first character in the applet_opts string is a plus,
then option processing will stop as soon as a non-option is
@@ -265,7 +265,7 @@ Special characters:
for "long options only" cases, such as tar --exclude=PATTERN,
wget --header=HDR cases.
- "a?b" A "?" between an option and a group of options means that
+ "a?bc" A "?" between an option and a group of options means that
at least one of them is required to occur if the first option
occurs in preceding command line arguments.