From bd419aca16f0d3cafcb13b386a5bcab7428e4009 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 3 Jun 2016 13:04:05 -0400 Subject: 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. --- color.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'color.c') 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) { -- cgit v1.2.3