diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2016-06-03 13:04:05 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2016-06-03 13:04:05 -0400 |
commit | bd419aca16f0d3cafcb13b386a5bcab7428e4009 (patch) | |
tree | e8b7ddde197d972d287d46fdb1b19cc3b2dbea1d /color.c | |
parent | 4a63d5dc061aefb12d608d5cd980b1efd4e29923 (diff) | |
download | bfs-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.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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) { |