SOURCES: fileutils.csh - Implement 'COLOR' keyword recognition (sa...
adgor
adgor at pld-linux.org
Mon Oct 2 02:34:19 CEST 2006
Author: adgor Date: Mon Oct 2 00:34:19 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- Implement 'COLOR' keyword recognition (same as in fileutils.sh)
- Seems to work
---- Files affected:
SOURCES:
fileutils.csh (1.3 -> 1.4)
---- Diffs:
================================================================
Index: SOURCES/fileutils.csh
diff -u SOURCES/fileutils.csh:1.3 SOURCES/fileutils.csh:1.4
--- SOURCES/fileutils.csh:1.3 Thu Sep 30 17:51:18 2004
+++ SOURCES/fileutils.csh Mon Oct 2 02:34:14 2006
@@ -1,2 +1,32 @@
-alias ls "ls --color=tty"
-eval `/usr/bin/dircolors -c /etc/DIR_COLORS`
+set SYS_RC_FILE=/etc/DIR_COLORS
+set USER_RC_FILE=$HOME/.dir_colors
+set DEF_COLOR_MODE=tty
+
+set COLOR_MODE=`grep ^COLOR $SYS_RC_FILE |head -n 1|cut -c 7-`
+
+test -r $USER_RC_FILE
+if ($status == 0) then
+ set COLOR_MODE=`grep ^COLOR $USER_RC_FILE |head -n 1|cut -c 7-`
+endif
+
+# 'all' argument for 'ls --color=' is no longer valid
+test "$COLOR_MODE" = all
+if ($status == 0) then
+ set COLOR_MODE=always
+endif
+
+test -z "$COLOR_MODE"
+if ($status == 0) then
+ set COLOR_MODE=$DEF_COLOR_MODE
+endif
+
+alias ls "ls --color=$COLOR_MODE"
+
+test -r $USER_RC_FILE
+if ($status == 0) then
+ eval `/usr/bin/dircolors -c $USER_RC_FILE`
+else
+ eval `/usr/bin/dircolors -c $SYS_RC_FILE`
+endif
+
+unset SYS_RC_FILE USER_RC_FILE DEF_COLOR_MODE
================================================================
---- CVS-web:
http://cvs.pld-linux.org/SOURCES/fileutils.csh?r1=1.3&r2=1.4&f=u
More information about the pld-cvs-commit
mailing list