home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20110725.etc.tar.gz / bradford.20110725.etc.tar / etc / profile.d / lang.csh < prev    next >
Text File  |  2005-08-02  |  2KB  |  85 lines

  1. #
  2. # lang.csh:    Set interactive language environment
  3. #
  4. # Used configuration files:
  5. #
  6. #     /etc/sysconfig/language
  7. #     $HOME/.i18n
  8. #
  9.  
  10. #
  11. # Already done by the remote SSH side
  12. #
  13. if ( ${?SSH_SENDS_LOCALE} ) goto end
  14.  
  15. #
  16. # Get the system and after that the users configuration
  17. #
  18. if ( -s /etc/sysconfig/language ) then
  19.     eval `sed -n \
  20.     -e 's/^RC_\(\(LANG\|LC_[A-Z_]\+\)\)=/set \1=/p' \
  21.     -e 's/^\(ROOT_USES_LANG\)=/set \1=/p' \
  22.     < /etc/sysconfig/language`
  23.     if ( "$uid" != 0 ) set ROOT_USES_LANG=yes
  24. endif
  25. if ( -s $HOME/.i18n ) then
  26.     eval `sed -n \
  27.     -e 's/^\(\(LANG\|LC_[A-Z_]\+\)\)=/set \1=/p' \
  28.     < $HOME/.i18n
  29. endif
  30.  
  31. #
  32. # Handle all LC and the LANG variable
  33. #
  34. foreach lc (LANG LC_CTYPE LC_NUMERIC LC_TIME    \
  35.         LC_COLLATE LC_MONETARY LC_MESSAGES    \
  36.         LC_PAPER LC_NAME LC_ADDRESS     \
  37.         LC_TELEPHONE LC_MEASUREMENT        \
  38.         LC_IDENTIFICATION LC_ALL)
  39.     eval set val=\${\?$lc}
  40.     if ( $val == 0 ) continue
  41.     eval set val=\$$lc
  42.     if  ( "$ROOT_USES_LANG" == "yes" ) then
  43.     if ( ${%val} == 0 ) then
  44.         eval unsetenv $lc
  45.         eval unset $lc
  46.     else
  47.         eval setenv $lc $val
  48.     endif
  49.     else if ( "$ROOT_USES_LANG" == "ctype" ) then
  50.     if ( "$lc" == "LANG" ) continue
  51.     if ( "$lc" == "LC_CTYPE" ) then
  52.         setenv LC_CTYPE $LANG
  53.         setenv LANG POSIX
  54.     else
  55.         eval unsetenv $lc
  56.         eval unset $lc
  57.     endif
  58.     else
  59.     if ( "$lc" == "LANG" ) then
  60.         setenv LANG POSIX
  61.     else
  62.         eval unsetenv $lc
  63.         eval unset $lc
  64.     endif
  65.     endif
  66. end
  67.  
  68. #
  69. # Special LC_ALL handling because the LC_ALL
  70. # overwrites all LC but not the LANG variable
  71. #
  72. if ( ${?LC_ALL} ) then
  73.     if ( ${%LC_ALL} > 0 && "$LC_ALL" != "$LANG" ) then
  74.     setenv LC_ALL $LC_ALL
  75.     else
  76.     unsetenv LC_ALL
  77.     unset LC_ALL
  78.     endif
  79. endif
  80.  
  81. unset ROOT_USES_LANG lc val
  82. end:
  83. #
  84. # end of lang.sh
  85.