summaryrefslogtreecommitdiffstats
path: root/color.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-06-02 23:40:17 -0400
committerTavian Barnes <tavianator@tavianator.com>2016-06-02 23:40:17 -0400
commit4a63d5dc061aefb12d608d5cd980b1efd4e29923 (patch)
treef399626776a0c1634d197073429493e5cdcb5117 /color.c
parentb4a0ed03d1f656ac8d4d9e2aab4d83af0f8462eb (diff)
downloadbfs-4a63d5dc061aefb12d608d5cd980b1efd4e29923.tar.xz
color: Add multi-hard link coloring support.
Diffstat (limited to 'color.c')
-rw-r--r--color.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/color.c b/color.c
index 3f56b4f..4ff3ebd 100644
--- a/color.c
+++ b/color.c
@@ -40,6 +40,7 @@ struct colors {
const char *block;
const char *chardev;
const char *orphan;
+ const char *missing;
const char *socket;
const char *setuid;
const char *setgid;
@@ -130,7 +131,7 @@ struct colors *parse_colors(const char *ls_colors) {
if (strcmp(key, "di") == 0) {
colors->dir = value;
} else if (strcmp(key, "do") == 0) {
- colors->socket = value;
+ colors->door = value;
}
break;
@@ -152,6 +153,14 @@ struct colors *parse_colors(const char *ls_colors) {
}
break;
+ case 'm':
+ if (strcmp(key, "mh") == 0) {
+ colors->multi_hard = value;
+ } else if (strcmp(key, "mi") == 0) {
+ colors->missing = value;
+ }
+ break;
+
case 'n':
if (strcmp(key, "no") == 0) {
colors->normal = value;
@@ -230,6 +239,10 @@ static const char *file_color(const struct colors *colors, const char *filename,
color = colors->exec;
}
+ if (!color && sb->st_nlink > 1) {
+ color = colors->multi_hard;
+ }
+
if (!color) {
size_t namelen = strlen(filename);