[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [PATCH] ls: recognize "never" for LS_COLORS
From: roger peppe <rogpeppe () gmail ! com>
Date: 2021-10-21 11:40:26
Message-ID: CAJhgachp=RxSSC+HUmhsdrZHRreM5_e-wU5+6Wq-ufQSK+J2qA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
[Aside: apologies if this is in the wrong format or otherwise contravenes
convention here - I'm not familiar with patch-oriented code bases; I'd have
raised an issue but I didn't see anywhere to do that and the busybox
website keeps on timing out on me]
This patch was made to commit 836b79211df3aeaba1b8b65c6db5ee6193172cc0.
The standard `ls` command uses the value "never" (not "none") to signify
that the output should not be colorized. This change lets the same value
apply consistently to `busybox ls` too.
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 48f5eb482..b446e5648 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -1148,8 +1148,8 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
/* set G_show_color = 1/0 */
if (ENABLE_FEATURE_LS_COLOR_IS_DEFAULT && !is_TERM_dumb()) {
char *p = getenv("LS_COLORS");
- /* LS_COLORS is unset, or (not empty && not "none") ? */
- if (!p || (p[0] && strcmp(p, "none") != 0)) {
+ /* LS_COLORS is unset, or (not empty && not "none" && not "never") ? */
+ if (!p || (p[0] && strcmp(p, "none") != 0 && strcmp(p, "never") != 0)) {
if (isatty(STDOUT_FILENO)) {
/* check isatty() last because it's expensive (syscall) */
G_show_color = 1;
[Attachment #5 (text/html)]
<div dir="ltr"><div>[Aside: apologies if this is in the wrong format or otherwise \
contravenes convention here - I'm not familiar with patch-oriented code bases; \
I'd have raised an issue but I didn't see anywhere to do that and the busybox \
website keeps on timing out on me]</div><div><br></div>This patch was made to commit \
836b79211df3aeaba1b8b65c6db5ee6193172cc0.<div><br></div><div>The standard `ls` \
command uses the value "never" (not "none") to signify that the \
output should not be colorized. This change lets the same value apply consistently to \
`busybox ls` too.<br><br>diff --git a/coreutils/ls.c b/coreutils/ls.c<br>index \
48f5eb482..b446e5648 100644<br>--- a/coreutils/ls.c<br>+++ b/coreutils/ls.c<br>@@ \
-1148,8 +1148,8 @@ int ls_main(int argc UNUSED_PARAM, char **argv)<br> /* set \
G_show_color = 1/0 */<br> if (ENABLE_FEATURE_LS_COLOR_IS_DEFAULT && \
!is_TERM_dumb()) {<br> char *p = getenv("LS_COLORS");<br>- /* LS_COLORS \
is unset, or (not empty && not "none") ? */<br>- if (!p || (p[0] \
&& strcmp(p, "none") != 0)) {<br>+ /* LS_COLORS is unset, or (not \
empty && not "none" && not "never") ? */<br>+ if \
(!p || (p[0] && strcmp(p, "none") != 0 && strcmp(p, \
"never") != 0)) {<br> if (isatty(STDOUT_FILENO)) {<br> /* check \
isatty() last because it's expensive (syscall) */<br> G_show_color = \
1;<br></div></div>
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic