summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coreutils/ls.c15
-rw-r--r--testsuite/ls/ls-1-works6
-rw-r--r--testsuite/ls/ls-h-works6
-rw-r--r--testsuite/ls/ls-l-works4
-rw-r--r--testsuite/ls/ls-s-works4
5 files changed, 22 insertions, 13 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 379b0f9..db42601 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -144,8 +144,7 @@ static const char ls_options[] ALIGN1 =
IF_FEATURE_LS_FOLLOWLINKS("L") /* 1, 24 */
IF_FEATURE_LS_RECURSIVE("R") /* 1, 25 */
IF_FEATURE_HUMAN_READABLE("h") /* 1, 26 */
- IF_SELINUX("K") /* 1, 27 */
- IF_SELINUX("Z") /* 1, 28 */
+ IF_SELINUX("KZ") /* 2, 28 */
IF_FEATURE_AUTOWIDTH("T:w:") /* 2, 30 */
;
enum {
@@ -162,6 +161,16 @@ enum {
OPT_Q = (1 << 10),
//OPT_A = (1 << 11),
//OPT_k = (1 << 12),
+ OPTBIT_color = 13
+ + 4 * ENABLE_FEATURE_LS_TIMESTAMPS
+ + 4 * ENABLE_FEATURE_LS_SORTFILES
+ + 2 * ENABLE_FEATURE_LS_FILETYPES
+ + 1 * ENABLE_FEATURE_LS_FOLLOWLINKS
+ + 1 * ENABLE_FEATURE_LS_RECURSIVE
+ + 1 * ENABLE_FEATURE_HUMAN_READABLE
+ + 2 * ENABLE_SELINUX
+ + 2 * ENABLE_FEATURE_AUTOWIDTH,
+ OPT_color = 1 << OPTBIT_color,
};
enum {
@@ -966,7 +975,7 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
if (!p || (p[0] && strcmp(p, "none") != 0))
show_color = 1;
}
- if (opt & (1 << i)) { /* next flag after short options */
+ if (opt & OPT_color) { /* next flag after short options */
if (strcmp("always", color_opt) == 0)
show_color = 1;
else if (strcmp("never", color_opt) == 0)
diff --git a/testsuite/ls/ls-1-works b/testsuite/ls/ls-1-works
index 8ad484f..8856949 100644
--- a/testsuite/ls/ls-1-works
+++ b/testsuite/ls/ls-1-works
@@ -1,4 +1,4 @@
[ -n "$d" ] || d=..
-ls -1 "$d" > logfile.gnu
-busybox ls -1 "$d" > logfile.bb
-cmp logfile.gnu logfile.bb
+LC_ALL=C ls -1 "$d" > logfile.gnu
+LC_ALL=C busybox ls -1 "$d" > logfile.bb
+diff -ubw logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-h-works b/testsuite/ls/ls-h-works
index 7331262..0c83f7c 100644
--- a/testsuite/ls/ls-h-works
+++ b/testsuite/ls/ls-h-works
@@ -1,4 +1,4 @@
[ -n "$d" ] || d=..
-ls -h "$d" > logfile.gnu
-busybox ls -h "$d" > logfile.bb
-cmp logfile.gnu logfile.bb
+LC_ALL=C ls -h "$d" > logfile.gnu
+LC_ALL=C busybox ls -h "$d" > logfile.bb
+diff -ubw logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-l-works b/testsuite/ls/ls-l-works
index efc2b19..1bad34b 100644
--- a/testsuite/ls/ls-l-works
+++ b/testsuite/ls/ls-l-works
@@ -1,4 +1,4 @@
[ -n "$d" ] || d=..
LC_ALL=C ls -l "$d" > logfile.gnu
-busybox ls -l "$d" > logfile.bb
-diff -w logfile.gnu logfile.bb
+LC_ALL=C busybox ls -l "$d" > logfile.bb
+diff -ubw logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-s-works b/testsuite/ls/ls-s-works
index 6c8bf36..0a9d752 100644
--- a/testsuite/ls/ls-s-works
+++ b/testsuite/ls/ls-s-works
@@ -1,4 +1,4 @@
[ -n "$d" ] || d=..
LC_ALL=C ls -1s "$d" > logfile.gnu
-busybox ls -1s "$d" > logfile.bb
-cmp logfile.gnu logfile.bb
+LC_ALL=C busybox ls -1s "$d" > logfile.bb
+diff -ubw logfile.gnu logfile.bb