summaryrefslogtreecommitdiffstats
path: root/color.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-06-03 13:04:05 -0400
committerTavian Barnes <tavianator@tavianator.com>2016-06-03 13:04:05 -0400
commitbd419aca16f0d3cafcb13b386a5bcab7428e4009 (patch)
treee8b7ddde197d972d287d46fdb1b19cc3b2dbea1d /color.c
parent4a63d5dc061aefb12d608d5cd980b1efd4e29923 (diff)
downloadbfs-bd419aca16f0d3cafcb13b386a5bcab7428e4009.tar.xz
color: Ignore colors that are all zeros.
This keeps multi_hard from overriding extension colors if LS_COLORS says mh=00:, matching the behavior of ls.
Diffstat (limited to 'color.c')
-rw-r--r--color.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/color.c b/color.c
index 4ff3ebd..47c2fb3 100644
--- a/color.c
+++ b/color.c
@@ -70,7 +70,7 @@ struct colors *parse_colors(const char *ls_colors) {
colors->file = NULL;
colors->dir = "01;34";
colors->link = "01;36";
- colors->multi_hard = "00";
+ colors->multi_hard = NULL;
colors->pipe = "40;33";
colors->socket = "01;35";
colors->door = "01;35";
@@ -112,6 +112,11 @@ struct colors *parse_colors(const char *ls_colors) {
const char *key = start;
const char *value = equals + 1;
+ // Ignore all-zero values
+ if (strspn(value, "0") == strlen(value)) {
+ continue;
+ }
+
switch (key[0]) {
case 'b':
if (strcmp(key, "bd") == 0) {