First of all, set LANG and LC_COLLATE and leave the rest alone. LANG
defaults most of the other variables, and forcing LC_COLLATE=POSIX fixes
the stupidity of ls(1) ordering things case-insensitively.
Secondly, if there's no DISPLAY, and TERM is `linux', prod vt-is-UTF8(1)
to find out which locale to use.
[ -z "$HOST" ] && export HOST=`hostname`
-if [ "$DISPLAY" = "" ]; then
- : ${LC_CTYPE=${LANG-${LC_ALL-`mdw-conf console-ctype`}}}
+if [ "$DISPLAY" != "" ]; then
+ LANG=`mdw-conf x-ctype`
else
- LC_CTYPE=`mdw-conf x-ctype`
+ : ${LANG=${LC_CTYPE-${LC_ALL-`mdw-conf console-ctype`}}}
+ case "$TERM" in
+ linux)
+ if vt-is-UTF8 >/dev/null 2>&1; then
+ ctype=.utf8
+ else
+ ctype=
+ fi
+ LANG=${LANG%.*}$ctype
+ ;;
+ esac
fi
-unset LANG LC_ALL
-export LC_CTYPE
-
-for lc in TIME NUMERIC MONETARY PAPER NAME ADDRESS TELEPHONE MEASUREMENT; do
- eval "export LC_$lc=$LC_CTYPE"
-done
-export LC_COLLATE=POSIX
+unset LC_ALL
+export LC_COLLATE=POSIX LANG
__mdw_programp distcc && export CCACHE_PREFIX=distcc