diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2024-12-16 01:10:55 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2024-12-16 01:12:17 +0100 |
commit | e2304d47a98a2eff65a3a0a13c53df2cc69529b1 (patch) | |
tree | c956e5ae579e97bcfda24bd22bc15bc5bbfbaf61 | |
parent | ee8b94acbf9ac9a6a48831a244cfef897affe82e (diff) | |
download | busybox-w32-e2304d47a98a2eff65a3a0a13c53df2cc69529b1.tar.gz busybox-w32-e2304d47a98a2eff65a3a0a13c53df2cc69529b1.tar.bz2 busybox-w32-e2304d47a98a2eff65a3a0a13c53df2cc69529b1.zip |
cut: shorten error messages on bad syntax even more
$ cut -s -b3
cut: -s requires -f or -F
$ cut -d@ -b3
cut: -d DELIM requires -f or -F
function old new delta
static.requires_f - 19 +19
static._op_on_field 32 - -32
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/0 up/down: 19/-32) Total: -13 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/cut.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/coreutils/cut.c b/coreutils/cut.c index af2fd9fd4..74a704c8f 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -330,16 +330,12 @@ int cut_main(int argc UNUSED_PARAM, char **argv) | |||
330 | 330 | ||
331 | /* non-field (char or byte) cutting has some special handling */ | 331 | /* non-field (char or byte) cutting has some special handling */ |
332 | if (!(opt & (OPT_FIELDS|OPT_REGEX))) { | 332 | if (!(opt & (OPT_FIELDS|OPT_REGEX))) { |
333 | static const char _op_on_field[] ALIGN1 = " makes sense only with -f"IF_FEATURE_CUT_REGEX(" or -F"); | 333 | static const char requires_f[] ALIGN1 = " requires -f" |
334 | 334 | IF_FEATURE_CUT_REGEX(" or -F"); | |
335 | if (opt & OPT_SUPPRESS) { | 335 | if (opt & OPT_SUPPRESS) |
336 | bb_error_msg_and_die | 336 | bb_error_msg_and_die("-s%s", requires_f); |
337 | ("-s%s", _op_on_field); | 337 | if (opt & OPT_DELIM) |
338 | } | 338 | bb_error_msg_and_die("-d DELIM%s", requires_f); |
339 | if (opt & OPT_DELIM) { | ||
340 | bb_error_msg_and_die | ||
341 | ("-d DELIM%s", _op_on_field); | ||
342 | } | ||
343 | } | 339 | } |
344 | 340 | ||
345 | /* | 341 | /* |