diff options
author | Laurent Bercot | 2017-05-26 16:50:53 +0200 |
---|---|---|
committer | Denys Vlasenko | 2017-05-26 16:50:53 +0200 |
commit | 2599937c4e5012d8e410d58574d22dec92e6eaa5 (patch) | |
tree | 045f52dfe01397291a8e21de49c0fca08e7beb99 /coreutils | |
parent | 13d72c3fd979a047179b1342dcae026379af0617 (diff) | |
download | busybox-2599937c4e5012d8e410d58574d22dec92e6eaa5.zip busybox-2599937c4e5012d8e410d58574d22dec92e6eaa5.tar.gz |
ls: fix support for long options when FEATURE_LS_COLOR is deselected
Declaration of ls_longopts and initialization of applet_long_options
were incorrectly guarded with ENABLE_FEATURE_LS_COLOR; that yielded a
"ls: NO_OPT: \xff" error message when long options were selected and
color support was not. This patch ensures long options are
initialized separately from color support.
Signed-off-by: Laurent Bercot <ska-dietlibc@skarnet.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/ls.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index 6e0a52d..6780057 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -1067,17 +1067,19 @@ int ls_main(int argc UNUSED_PARAM, char **argv) * 'auto', 'tty', 'if-tty' * (and substrings: "--color=alwa" work too) */ - static const char ls_longopts[] ALIGN1 = - "full-time\0" No_argument "\xff" - "group-directories-first\0" No_argument "\xfe" - "color\0" Optional_argument "\xfd" - ; static const char color_str[] ALIGN1 = "always\0""yes\0""force\0" "auto\0""tty\0""if-tty\0"; /* need to initialize since --color has _an optional_ argument */ const char *color_opt = color_str; /* "always" */ #endif +#if ENABLE_LONG_OPTS + static const char ls_longopts[] ALIGN1 = + "full-time\0" No_argument "\xff" + "group-directories-first\0" No_argument "\xfe" + "color\0" Optional_argument "\xfd" + ; +#endif INIT_G(); @@ -1091,7 +1093,7 @@ int ls_main(int argc UNUSED_PARAM, char **argv) #endif /* process options */ - IF_FEATURE_LS_COLOR(applet_long_options = ls_longopts;) + IF_LONG_OPTS(applet_long_options = ls_longopts;) opt_complementary = /* -n and -g imply -l */ "nl:gl" |