diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2024-12-13 20:35:28 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2024-12-13 20:35:28 +0100 |
commit | d48400d8fb266526059eb43b318cb95132f61fb3 (patch) | |
tree | 8b687b60ecfb3edac6eb95be897ecd4362ecf563 | |
parent | 7624077772878db25d8221fc4d6f731e29ebcdba (diff) | |
download | busybox-w32-d48400d8fb266526059eb43b318cb95132f61fb3.tar.gz busybox-w32-d48400d8fb266526059eb43b318cb95132f61fb3.tar.bz2 busybox-w32-d48400d8fb266526059eb43b318cb95132f61fb3.zip |
cut: simplify getopt32 code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/cut.c | 19 |
1 files 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) | |||
291 | #endif | 291 | #endif |
292 | 292 | ||
293 | #define ARG "bcf"IF_FEATURE_CUT_REGEX("F") | 293 | #define ARG "bcf"IF_FEATURE_CUT_REGEX("F") |
294 | #if !ENABLE_LONG_OPTS | 294 | #if ENABLE_LONG_OPTS |
295 | opt = getopt32(argv, "^" | 295 | opt = getopt32long |
296 | OPT_STR // = "b:c:f:d:O:sD"IF_FEATURE_CUT_REGEX("F:")"n" | ||
297 | "\0" "b--"ARG":c--"ARG":f--"ARG IF_FEATURE_CUT_REGEX("F--"ARG), | ||
298 | &sopt, &sopt, &sopt, &delim, &odelim IF_FEATURE_CUT_REGEX(, &sopt) | ||
299 | ); | ||
300 | #else | 296 | #else |
301 | opt = getopt32long(argv, "^" | 297 | opt = getopt32 |
298 | #endif | ||
299 | (argv, "^" | ||
302 | OPT_STR // = "b:c:f:d:O:sD"IF_FEATURE_CUT_REGEX("F:")"n" | 300 | OPT_STR // = "b:c:f:d:O:sD"IF_FEATURE_CUT_REGEX("F:")"n" |
303 | "\0" "b:c:f:"IF_FEATURE_CUT_REGEX("F:") /* one of -bcfF is required */ | 301 | "\0" "b:c:f:" IF_FEATURE_CUT_REGEX("F:") /* one of -bcfF is required */ |
304 | "b--"ARG":c--"ARG":f--"ARG IF_FEATURE_CUT_REGEX(":F--"ARG), /* they are mutually exclusive */ | 302 | "b--"ARG":c--"ARG":f--"ARG IF_FEATURE_CUT_REGEX(":F--"ARG), /* they are mutually exclusive */ |
305 | cut_longopts, | 303 | IF_LONG_OPTS(cut_longopts,) |
306 | &sopt, &sopt, &sopt, &delim, &odelim IF_FEATURE_CUT_REGEX(, &sopt) | 304 | &sopt, &sopt, &sopt, &delim, &odelim IF_FEATURE_CUT_REGEX(, &sopt) |
307 | ); | 305 | ); |
308 | #endif | ||
309 | if (!odelim) | 306 | if (!odelim) |
310 | odelim = (opt & OPT_REGEX) ? " " : delim; | 307 | odelim = (opt & OPT_REGEX) ? " " : delim; |
311 | if (!delim) | 308 | if (!delim) |