Blame SOURCES/coreutils-colorls.csh

d3767b
# skip everything for non-interactive shells
d3767b
if (! $?prompt) exit
d3767b
d3767b
# color-ls initialization
d3767b
if ( $?USER_LS_COLORS ) then
d3767b
  if ( "$USER_LS_COLORS" != "" ) then
d3767b
     #when USER_LS_COLORS defined do not override user
d3767b
     #specified LS_COLORS and use them
d3767b
     goto finish
d3767b
  endif
d3767b
endif
d3767b
d3767b
alias ll 'ls -l'
d3767b
alias l. 'ls -d .*'
d3767b
set COLORS=/etc/DIR_COLORS
d3767b
d3767b
if ($?TERM) then
d3767b
  if ( -e "/etc/DIR_COLORS.256color" ) then
d3767b
    if ( "`/usr/bin/tput colors`" == "256" ) then
d3767b
       set COLORS=/etc/DIR_COLORS.256color
d3767b
    endif
d3767b
  endif
d3767b
  if ( -e "/etc/DIR_COLORS.$TERM" ) then
d3767b
     set COLORS="/etc/DIR_COLORS.$TERM"
d3767b
  endif
d3767b
endif
d3767b
if ( -f ~/.dircolors ) set COLORS=~/.dircolors
d3767b
if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors
d3767b
if ($?TERM) then
d3767b
  if ( -f ~/.dircolors."$TERM" ) set COLORS=~/.dircolors."$TERM"
d3767b
  if ( -f ~/.dir_colors."$TERM" ) set COLORS=~/.dir_colors."$TERM"
d3767b
endif
d3767b
set INCLUDE="`/usr/bin/cat "$COLORS" | /usr/bin/grep '^INCLUDE' | /usr/bin/cut -d ' ' -f2-`"
d3767b
d3767b
if ( ! -e "$COLORS" ) exit
d3767b
d3767b
set _tmp="`/usr/bin/mktemp .colorlsXXX -q --tmpdir=/tmp`"
d3767b
#if mktemp fails, exit when include was active, otherwise use $COLORS file
d3767b
if ( "$_tmp" == '' ) then
d3767b
  if ( "$INCLUDE" == '' ) then
d3767b
    eval "`/usr/bin/dircolors -c $COLORS`"
d3767b
  endif
d3767b
  goto cleanup
d3767b
endif
d3767b
d3767b
if ( "$INCLUDE" != '' ) /usr/bin/cat "$INCLUDE" >> $_tmp
d3767b
/usr/bin/grep -v '^INCLUDE' "$COLORS" >> $_tmp
d3767b
d3767b
eval "`/usr/bin/dircolors -c $_tmp`"
d3767b
d3767b
/usr/bin/rm -f $_tmp
d3767b
d3767b
if ( "$LS_COLORS" == '' ) exit
d3767b
cleanup:
d3767b
set color_none=`/usr/bin/sed -n '/^COLOR.*none/Ip' < $COLORS`
d3767b
if ( "$color_none" != '' ) then
d3767b
   unset color_none
d3767b
   exit
d3767b
endif
d3767b
unset color_none
d3767b
unset _tmp
d3767b
unset INCLUDE
d3767b
unset COLORS
d3767b
d3767b
finish:
d3767b
alias ll 'ls -l --color=auto'
d3767b
alias l. 'ls -d .* --color=auto'
d3767b
alias ls 'ls --color=auto'