63 lines
2.2 KiB
Plaintext
63 lines
2.2 KiB
Plaintext
--- src/ls.c.orig Sun Apr 29 05:42:47 2001
|
|
+++ src/ls.c Mon Feb 24 23:18:38 2003
|
|
@@ -510,13 +510,13 @@ enum color_type
|
|
enum indicator_no
|
|
{
|
|
C_LEFT, C_RIGHT, C_END, 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_BLK, C_CHR, C_MISSING, C_ORPHAN, C_EXEC, C_DOOR, C_UID, C_GID, C_WRO, C_WT
|
|
};
|
|
|
|
static const char *const indicator_name[]=
|
|
{
|
|
"lc", "rc", "ec", "no", "fi", "di", "ln", "pi", "so",
|
|
- "bd", "cd", "mi", "or", "ex", "do", NULL
|
|
+ "bd", "cd", "mi", "or", "ex", "do", "su", "sg", "wo", "wt", NULL
|
|
};
|
|
|
|
struct color_ext_type
|
|
@@ -542,7 +542,11 @@ static struct bin_str color_indicator[]
|
|
{ 0, NULL }, /* mi: Missing file: undefined */
|
|
{ 0, NULL }, /* or: Orphanned symlink: undefined */
|
|
{ LEN_STR_PAIR ("01;32") }, /* ex: Executable: bright green */
|
|
- { LEN_STR_PAIR ("01;35") } /* do: Door: bright magenta */
|
|
+ { LEN_STR_PAIR ("01;35") }, /* do: Door: bright magenta */
|
|
+ { LEN_STR_PAIR ("37;41") }, /* su: setuid: white on red */
|
|
+ { LEN_STR_PAIR ("30;43") }, /* sg: setgid: black on yellow */
|
|
+ { LEN_STR_PAIR ("37;44") }, /* wo: writeable-other:white on blue */
|
|
+ { LEN_STR_PAIR ("37;42") }, /* wt: wo w/ sticky: white on green */
|
|
};
|
|
|
|
/* FIXME: comment */
|
|
@@ -2883,7 +2887,14 @@ print_color_indicator (const char *name,
|
|
else
|
|
{
|
|
if (S_ISDIR (mode))
|
|
- type = C_DIR;
|
|
+ {
|
|
+ if ((mode && MODE_WT) == MODE_WT)
|
|
+ type = C_WT;
|
|
+ else if ((mode && MODE_WRO) == MODE_WRO)
|
|
+ type = C_WRO;
|
|
+ else
|
|
+ type = C_DIR;
|
|
+ }
|
|
else if (S_ISLNK (mode))
|
|
type = ((!linkok && color_indicator[C_ORPHAN].string)
|
|
? C_ORPHAN : C_LINK);
|
|
@@ -2898,7 +2909,13 @@ print_color_indicator (const char *name,
|
|
else if (S_ISDOOR (mode))
|
|
type = C_DOOR;
|
|
|
|
- if (type == C_FILE && (mode & S_IXUGO) != 0)
|
|
+ if ((type == C_FILE) && ((mode & S_ISUID) != 0))
|
|
+ type = C_UID;
|
|
+
|
|
+ else if ((type == C_FILE) && ((mode & S_ISGID) != 0))
|
|
+ type = C_GID;
|
|
+
|
|
+ else if (type == C_FILE && (mode & S_IXUGO) != 0)
|
|
type = C_EXEC;
|
|
|
|
/* Check the file's suffix only if still classified as C_FILE. */
|