rpms/coreutils/devel coreutils-colorls.csh, 1.4, 1.5 coreutils-colorls.sh, 1.5, 1.6 coreutils.spec, 1.191, 1.192

Ondrej Vasik (ovasik) fedora-extras-commits at redhat.com
Mon Feb 4 16:50:01 UTC 2008


Author: ovasik

Update of /cvs/extras/rpms/coreutils/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv1876

Modified Files:
	coreutils-colorls.csh coreutils-colorls.sh coreutils.spec 
Log Message:
256 color support in sh/csh colorls scripts(#429121), fixed syntax error in csh script(#431315)


Index: coreutils-colorls.csh
===================================================================
RCS file: /cvs/extras/rpms/coreutils/devel/coreutils-colorls.csh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- coreutils-colorls.csh	31 Jan 2008 15:55:47 -0000	1.4
+++ coreutils-colorls.csh	4 Feb 2008 16:49:24 -0000	1.5
@@ -1,51 +1,45 @@
 #! /bin/csh -f
 # color-ls initialization
-if ( "$LS_COLORS" != '' ) then
-   #do not override user specified LS_COLORS and use them
-   alias ll 'ls -l --color=tty'
-   alias l. 'ls -d .* --color=tty'
-   alias ls 'ls --color=tty'
-   exit
+if ( $?LS_COLORS ) then
+  if ( $LS_COLORS != "" ) then
+     #do not override user specified LS_COLORS and use them
+     goto finish
+  endif
 endif
 
 alias ll 'ls -l'
 alias l. 'ls -d .*'
-
 set COLORS=/etc/DIR_COLORS
 if ($?TERM) then
-    if ( -e "/etc/DIR_COLORS.$TERM" ) then 
-       set COLORS="/etc/DIR_COLORS.$TERM"
-    endif
-endif
-if ( -f ~/.dircolors ) then 
-   set COLORS=~/.dircolors
-endif
-if ( -f ~/.dir_colors ) then 
-   set COLORS=~/.dir_colors
+  if ( -e "/etc/DIR_COLORS.$TERM" ) then 
+     set COLORS="/etc/DIR_COLORS.$TERM"
+  endif
+endif
+if ( -e "/etc/DIR_COLORS.256color" ) then
+  if ( "`infocmp $TERM | sed -n 's/.*colors#\([0-9]\+\).*/\1/p'`" == "256" ) then
+     set COLORS=/etc/DIR_COLORS.256color
+  endif 
 endif
+if ( -f ~/.dircolors ) set COLORS=~/.dircolors
+if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors
 if ($?TERM) then
-    if ( -f ~/.dircolors."$TERM" ) then 
-       set COLORS=~/.dircolors."$TERM"
-    endif
-    if ( -f ~/.dir_colors."$TERM" ) then 
-       set COLORS=~/.dir_colors."$TERM"
-    endif
+  if ( -f ~/.dircolors."$TERM" ) set COLORS=~/.dircolors."$TERM"
+  if ( -f ~/.dir_colors."$TERM" ) set COLORS=~/.dir_colors."$TERM"
 endif
 
-if ( ! -e "$COLORS" ) then 
-   exit
-endif
+if ( ! -e "$COLORS" ) exit
 
-eval `dircolors -c $COLORS`
-
-if ( "$LS_COLORS" == '' ) then
-   exit
-endif
+eval `dircolors -c $COLORS 2>/dev/null`
 
+if ( "$LS_COLORS" == '' ) exit
 set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS`
-if ( "$color_none" == '' ) then
-   alias ll 'ls -l --color=tty'
-   alias l. 'ls -d .* --color=tty'
-   alias ls 'ls --color=tty'
+if ( "$color_none" != '' ) then 
+   unset color_none
+   exit
 endif
 unset color_none
+
+finish:
+alias ll 'ls -l --color=tty'
+alias l. 'ls -d .* --color=tty'
+alias ls 'ls --color=tty'


Index: coreutils-colorls.sh
===================================================================
RCS file: /cvs/extras/rpms/coreutils/devel/coreutils-colorls.sh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- coreutils-colorls.sh	31 Jan 2008 16:29:15 -0000	1.5
+++ coreutils-colorls.sh	4 Feb 2008 16:49:24 -0000	1.6
@@ -1,28 +1,25 @@
 # color-ls initialization
-if [ -n "$LS_COLORS" ]; then
-  #do not override user LS_COLORS but use them
-  alias ll='ls -l --color=tty' 2>/dev/null
-	alias l.='ls -d .* --color=tty' 2>/dev/null
-	alias ls='ls --color=tty' 2>/dev/null
-  return
-fi
-
-alias ll='ls -l' 2>/dev/null
-alias l.='ls -d .*' 2>/dev/null
+if [ -z "$LS_COLORS" ]; then
+  #do not override user LS_COLORS, so perform only for zero sized LS_COLORS
+  alias ll='ls -l' 2>/dev/null
+  alias l.='ls -d .*' 2>/dev/null
 
-COLORS=/etc/DIR_COLORS
-[ -e "/etc/DIR_COLORS.$TERM" ] && COLORS="/etc/DIR_COLORS.$TERM"
-[ -e "$HOME/.dircolors" ] && COLORS="$HOME/.dircolors"
-[ -e "$HOME/.dir_colors" ] && COLORS="$HOME/.dir_colors"
-[ -e "$HOME/.dircolors.$TERM" ] && COLORS="$HOME/.dircolors.$TERM"
-[ -e "$HOME/.dir_colors.$TERM" ] && COLORS="$HOME/.dir_colors.$TERM"
-[ -e "$COLORS" ] || return
+  COLORS=/etc/DIR_COLORS
+  [ -e "/etc/DIR_COLORS.$TERM" ] && COLORS="/etc/DIR_COLORS.$TERM"
+  [ -e "/etc/DIR_COLORS.256color" ] && \
+     [ "`infocmp $TERM | sed -n 's/.*colors#\([0-9]\+\).*/\1/p'`" -eq 256 ] && \
+     COLORS="/etc/DIR_COLORS.256color"
+  [ -e "$HOME/.dircolors" ] && COLORS="$HOME/.dircolors"
+  [ -e "$HOME/.dir_colors" ] && COLORS="$HOME/.dir_colors"
+  [ -e "$HOME/.dircolors.$TERM" ] && COLORS="$HOME/.dircolors.$TERM"
+  [ -e "$HOME/.dir_colors.$TERM" ] && COLORS="$HOME/.dir_colors.$TERM"
+  [ -e "$COLORS" ] || return
 
-eval `dircolors --sh "$COLORS" 2>/dev/null`
-[ -z "$LS_COLORS" ] && return
-
-if ! egrep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null ; then
-	alias ll='ls -l --color=tty' 2>/dev/null
-	alias l.='ls -d .* --color=tty' 2>/dev/null
-	alias ls='ls --color=tty' 2>/dev/null
+  eval `dircolors --sh "$COLORS" 2>/dev/null`
+  [ -z "$LS_COLORS" ] && return
+  egrep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return
 fi
+
+alias ll='ls -l --color=tty' 2>/dev/null
+alias l.='ls -d .* --color=tty' 2>/dev/null
+alias ls='ls --color=tty' 2>/dev/null


Index: coreutils.spec
===================================================================
RCS file: /cvs/extras/rpms/coreutils/devel/coreutils.spec,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -r1.191 -r1.192
--- coreutils.spec	31 Jan 2008 16:47:43 -0000	1.191
+++ coreutils.spec	4 Feb 2008 16:49:24 -0000	1.192
@@ -1,7 +1,7 @@
 Summary: The GNU core utilities: a set of tools commonly used in shell scripts
 Name:    coreutils
 Version: 6.10
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: GPLv3+
 Group:   System Environment/Base
 Url:     http://www.gnu.org/software/coreutils/
@@ -291,6 +291,10 @@
 /sbin/runuser
 
 %changelog
+* Mon Feb  4 2008 Ondrej Vasik <ovasik at redhat.com> - 6.10-5
+- enabled 256-color support in colorls shell scripts(#429121)
+- fixed syntax error in csh script(#431315)
+
 * Thu Jan 31 2008 Ondrej Vasik <ovasik at redhat.com> - 6.10-4
 - forgotten return in colorls.sh change
 




More information about the fedora-extras-commits mailing list