[git commit] cut: simplify getopt32 code
Denys Vlasenko
vda.linux at googlemail.com
Fri Dec 13 19:35:28 UTC 2024
commit: https://git.busybox.net/busybox/commit/?id=d48400d8fb266526059eb43b318cb95132f61fb3
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
coreutils/cut.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/coreutils/cut.c b/coreutils/cut.c
index 9a99ad05c..f4cf5401b 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -291,21 +291,18 @@ int cut_main(int argc UNUSED_PARAM, char **argv)
#endif
#define ARG "bcf"IF_FEATURE_CUT_REGEX("F")
-#if !ENABLE_LONG_OPTS
- opt = getopt32(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),
- &sopt, &sopt, &sopt, &delim, &odelim IF_FEATURE_CUT_REGEX(, &sopt)
- );
+#if ENABLE_LONG_OPTS
+ opt = getopt32long
#else
- opt = getopt32long(argv, "^"
+ opt = getopt32
+#endif
+ (argv, "^"
OPT_STR // = "b:c:f:d:O:sD"IF_FEATURE_CUT_REGEX("F:")"n"
- "\0" "b:c:f:"IF_FEATURE_CUT_REGEX("F:") /* one of -bcfF is required */
+ "\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,
+ IF_LONG_OPTS(cut_longopts,)
&sopt, &sopt, &sopt, &delim, &odelim IF_FEATURE_CUT_REGEX(, &sopt)
- );
-#endif
+ );
if (!odelim)
odelim = (opt & OPT_REGEX) ? " " : delim;
if (!delim)
More information about the busybox-cvs
mailing list