[git commit] cut: shorten error messages on bad syntax even more
Denys Vlasenko
vda.linux at googlemail.com
Mon Dec 16 00:12:17 UTC 2024
commit: https://git.busybox.net/busybox/commit/?id=e2304d47a98a2eff65a3a0a13c53df2cc69529b1
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
$ 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 at googlemail.com>
---
coreutils/cut.c | 16 ++++++----------
1 file 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)
/* non-field (char or byte) cutting has some special handling */
if (!(opt & (OPT_FIELDS|OPT_REGEX))) {
- static const char _op_on_field[] ALIGN1 = " makes sense only with -f"IF_FEATURE_CUT_REGEX(" or -F");
-
- if (opt & OPT_SUPPRESS) {
- bb_error_msg_and_die
- ("-s%s", _op_on_field);
- }
- if (opt & OPT_DELIM) {
- bb_error_msg_and_die
- ("-d DELIM%s", _op_on_field);
- }
+ static const char requires_f[] ALIGN1 = " requires -f"
+ IF_FEATURE_CUT_REGEX(" or -F");
+ if (opt & OPT_SUPPRESS)
+ bb_error_msg_and_die("-s%s", requires_f);
+ if (opt & OPT_DELIM)
+ bb_error_msg_and_die("-d DELIM%s", requires_f);
}
/*
More information about the busybox-cvs
mailing list