Blame SOURCES/coreutils-colorls.csh

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