patches from gnuls

This commit is contained in:
wilfried 2001-03-15 18:17:54 +00:00
parent 7a5de8b7c3
commit 3b29ab062a
3 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-src_dircolors_c,v 1.1 2001/03/15 18:17:54 wilfried Exp $
--- src/dircolors.c.orig Sat Sep 19 13:09:23 1998
+++ src/dircolors.c Thu Mar 15 08:11:07 2001
@@ -68,13 +68,15 @@ static const char *const slack_codes[] =
"NORMAL", "NORM", "FILE", "DIR", "LNK", "LINK",
"SYMLINK", "ORPHAN", "MISSING", "FIFO", "PIPE", "SOCK", "BLK", "BLOCK",
"CHR", "CHAR", "EXEC", "LEFT", "LEFTCODE", "RIGHT", "RIGHTCODE", "END",
- "ENDCODE", NULL
+ "ENDCODE", "SUID", "SETUID", "SGID", "SETGID", "WRO", "WRITEOTHERS",
+ "WT", "WROT", "WRITEOTHERSSTICKY", NULL
};
static const char *const ls_codes[] =
{
"no", "no", "fi", "di", "ln", "ln", "ln", "or", "mi", "pi", "pi",
"so", "bd", "bd", "cd", "cd", "ex", "lc", "lc", "rc", "rc", "ec", "ec"
+ "su", "su", "sg", "sg", "wo", "wo", "wo", "wt", "wt", "wt", NULL
};
static struct option const long_options[] =

View File

@ -0,0 +1,63 @@
$OpenBSD: patch-src_ls_c,v 1.1 2001/03/15 18:17:54 wilfried Exp $
--- src/ls.c.orig Sat Sep 19 13:09:23 1998
+++ src/ls.c Thu Mar 15 08:11:07 2001
@@ -368,13 +368,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_BLK, C_CHR, C_MISSING, C_ORPHAN, C_EXEC, 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", NULL
+ "bd", "cd", "mi", "or", "ex", "su", "sg", "wo", "wt", NULL
};
struct col_ext_type
@@ -399,7 +399,11 @@ static struct bin_str color_indicator[]
{ LEN_STR_PAIR ("01;33") }, /* cd: Char device: bright yellow */
{ 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;32") }, /* ex: Executable: bright green */
+ { 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 */
@@ -2477,7 +2481,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;
+ }
#ifdef S_ISLNK
else if (S_ISLNK (mode))
@@ -2505,7 +2516,13 @@ print_color_indicator (const char *name,
type = C_CHR;
#endif
- 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. */

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-src_ls_h,v 1.1 2001/03/15 18:17:55 wilfried Exp $
--- src/ls.h.orig Sun Jan 4 23:35:28 1998
+++ src/ls.h Thu Mar 15 08:11:07 2001
@@ -7,4 +7,7 @@
/* This is for the `vdir' program. */
#define LS_LONG_FORMAT 3
+#define MODE_WT 01002
+#define MODE_WRO 02
+
extern int ls_mode;