[PATCH 4/8] ls_colors.c: new color descriptors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After coreutils moved to GPL-3 a couple more color descriptors were
added. parse_ls_color() will abort if it finds any of these so just
add them recognized (but never actually use them).

Reference commits (in coreutils.git)

0df338f (ls --color: do not colorize files with multiple hard links by default - 2009-06-10)
adc62b5 (ls: clean up after wrapped+colored file names with clear-to-EOL - 2008-12-31)
1e48b1f (ls: --color now highlights hard linked files, too - 2008-10-27)
84f6abf (ls: --color now highlights files with capabilities, too - 2008-08-01)
483297d (ls --color no longer outputs unnecessary escape sequences - 2008-02-12)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 ls_colors.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/ls_colors.c b/ls_colors.c
index 23f1e0b..02fc632 100644
--- a/ls_colors.c
+++ b/ls_colors.c
@@ -5,9 +5,12 @@
 #define STREQ(a, b) (strcmp(a, b) == 0)
 
 enum indicator_no {
-	C_LEFT, C_RIGHT, C_END, C_NORM, C_FILE, C_DIR, C_LINK, C_FIFO, C_SOCK,
+	C_LEFT, C_RIGHT, C_END, C_RESET, C_NORM,
+	C_FILE, C_DIR, C_LINK, C_FIFO, C_SOCK,
 	C_BLK, C_CHR, C_MISSING, C_ORPHAN, C_EXEC, C_DOOR, C_SETUID, C_SETGID,
-	C_STICKY, C_OTHER_WRITABLE, C_STICKY_OTHER_WRITABLE
+	C_STICKY, C_OTHER_WRITABLE, C_STICKY_OTHER_WRITABLE,
+	C_CAP, C_MULTIHARDLINK, C_CLR_TO_EOL
+
 };
 
 #define FILETYPE_INDICATORS				\
@@ -28,9 +31,9 @@ struct color_ext_type {
 };
 
 static const char *const indicator_name[]= {
-	"lc", "rc", "ec", "no", "fi", "di", "ln", "pi", "so",
+	"lc", "rc", "ec", "rs", "no", "fi", "di", "ln", "pi", "so",
 	"bd", "cd", "mi", "or", "ex", "do", "su", "sg", "st",
-	"ow", "tw", NULL
+	"ow", "tw", "ca", "mh", "cl", NULL
 };
 
 #define LEN_STR_PAIR(s) sizeof(s) - 1, s
@@ -38,6 +41,7 @@ static struct bin_str color_indicator[] = {
 	{ LEN_STR_PAIR("\033[") },	/* lc: Left of color sequence */
 	{ LEN_STR_PAIR("m") },		/* rc: Right of color sequence */
 	{ 0, NULL },			/* ec: End color (replaces lc+no+rc) */
+	{ 0, NULL },			/* rs: Reset to ordinary colors */
 	{ LEN_STR_PAIR("0") },		/* no: Normal */
 	{ LEN_STR_PAIR("0") },		/* fi: File: default */
 	{ LEN_STR_PAIR("01;34") },	/* di: Directory: bright blue */
@@ -55,6 +59,9 @@ static struct bin_str color_indicator[] = {
 	{ LEN_STR_PAIR("37;44") },	/* st: sticky: black on blue */
 	{ LEN_STR_PAIR("34;42") },	/* ow: other-writable: blue on green */
 	{ LEN_STR_PAIR("30;42") },	/* tw: ow w/ sticky: black on green */
+	{ 0, NULL },			/* ca: black on red */
+	{ 0, NULL },			/* mh: disabled by default */
+	{ 0, NULL },			/* cl: clear to end of line */
 };
 
 static struct color_ext_type *color_ext_list = NULL;
-- 
1.9.0.40.gaa8c3ea

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]