home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 January / Disc 3 / Amethyst.iso / live / usr / X11R6 / bin / uxterm < prev    next >
Encoding:
Text File  |  2002-11-14  |  1.1 KB  |  45 lines

  1. #!/bin/sh
  2. # $XFree86: xc/programs/xterm/uxterm,v 1.5 2002/01/05 22:05:03 dickey Exp $
  3. # wrapper script to setup xterm with UTF-8 locale
  4.  
  5. program=xterm
  6. found=no
  7.  
  8. # Check environment variables that xterm does, in the same order:
  9. for name in LC_ALL LC_CTYPE LANG
  10. do
  11.     eval 'value=$'$name
  12.     if test -n "$value" ; then
  13.         case $value in
  14.         *.UTF-8)
  15.             found=yes
  16.             ;;
  17.         C|POSIX)
  18.             # Yes, I know this is not the same - but why are you
  19.             # here then?
  20.             value=en_US
  21.             ;;
  22.         esac
  23.         break
  24.     fi
  25. done
  26.  
  27. # If we didn't find one that used UTF-8, modify the safest one.  Not everyone
  28. # has a UTF-8 locale installed (and there appears to be no trivial/portable way
  29. # to determine whether it is, from a shell script).  We could check if the
  30. # user's shell does not reset unknown locale specifiers, but not all shells do.
  31. if test $found != yes ; then
  32.     if test -n "$value" ; then
  33.         eval ${name}=`echo ${value} |sed -e 's/\..*//'`.UTF-8
  34.         eval export ${name}
  35.     else
  36.         LC_CTYPE=en_US.UTF-8
  37.         export LC_CTYPE
  38.     fi
  39. fi
  40.  
  41. # for testing:
  42. #test -f ./xterm && program=./xterm
  43.  
  44. exec $program -class UXTerm -title 'uxterm' -u8 "$@"
  45.