From ee8b94acbf9ac9a6a48831a244cfef897affe82e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 16 Dec 2024 00:51:31 +0100 Subject: cut: shorten error messages on bad syntax We don't need to mimic GNU cut error messages. $ cut -d@ -b3 cut: -d DELIM makes sense only with -f or -F $ cut -s -b3 cut: -s makes sense only with -f or -F function old new delta static._op_on_field 31 32 +1 .rodata 105659 105598 -61 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 1/-61) Total: -60 bytes Signed-off-by: Denys Vlasenko --- coreutils/cut.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coreutils/cut.c b/coreutils/cut.c index 0913c4b68..af2fd9fd4 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -330,15 +330,15 @@ 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 = " only when operating on fields"; + 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 - ("suppressing non-delimited lines makes sense%s", _op_on_field); + ("-s%s", _op_on_field); } if (opt & OPT_DELIM) { bb_error_msg_and_die - ("a delimiter may be specified%s", _op_on_field); + ("-d DELIM%s", _op_on_field); } } -- cgit v1.2.3-55-g6feb