diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2022-05-11 18:34:32 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2022-05-11 18:34:32 -0400 |
commit | cd4f7b60e7bba67d746bcf96b50208b66adf20fe (patch) | |
tree | c367076c64820c0f56719a8564d5182e5da57910 | |
parent | f9a23f1f21a0733feed0eaa657224fe205ae9a16 (diff) | |
download | bfs-cd4f7b60e7bba67d746bcf96b50208b66adf20fe.tar.xz |
color: Only check ln=target once
Fixes: 7241d6cc35134fcb5ec6dfa81bbd01e430b2415f
-rw-r--r-- | src/color.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/color.c b/src/color.c index 9e267da..b543882 100644 --- a/src/color.c +++ b/src/color.c @@ -406,12 +406,6 @@ static void parse_gnu_ls_colors(struct colors *colors, const char *ls_colors) { free(key); } } - - if (colors->link && strcmp(colors->link, "target") == 0) { - colors->link_as_target = true; - dstrfree(colors->link); - colors->link = NULL; - } } struct colors *parse_colors() { @@ -448,7 +442,7 @@ struct colors *parse_colors() { // Defaults from man dir_colors - ret |= init_color(colors, "no", NULL, &colors->normal); + ret |= init_color(colors, "no", NULL, &colors->normal); ret |= init_color(colors, "fi", NULL, &colors->file); ret |= init_color(colors, "mh", NULL, &colors->multi_hard); @@ -481,6 +475,12 @@ struct colors *parse_colors() { parse_gnu_ls_colors(colors, getenv("LS_COLORS")); parse_gnu_ls_colors(colors, getenv("BFS_COLORS")); + if (colors->link && strcmp(colors->link, "target") == 0) { + colors->link_as_target = true; + dstrfree(colors->link); + colors->link = NULL; + } + return colors; } |