#!/bin/sh
whoami=uxterm
: ${XTERM_PROGRAM=xterm}
locale=`sh -c "LC_ALL=C LC_CTYPE=C LANG=C locale >/dev/null" 2>&1`
found=no
if test $then
case $1 in
-v|-ver*|-h|-he*)
$XTERM_PROGRAM "$@"
exit $?
;;
esac
fi
for name in LC_ALL LC_CTYPE LANG
do
eval 'value=$'$name
if test -n "$value" ; then
case $value in
*.utf8|*.UTF8|*.utf-8|*.UTF-8)
found=yes
;;
*.utf8@*|*.UTF8@*|*.utf-8@*|*.UTF-8@*)
found=yes
;;
C|POSIX)
value=en_US
;;
esac
break
fi
done
if test $found != yes ; then
if test -n "$value" ; then
value=`echo ${value} |sed -e 's/[.@].*//'`.UTF-8
else
name="LC_CTYPE"
value="en_US.UTF-8"
fi
eval save=\$${name}
eval ${name}=${value}
eval export ${name}
if test -z "$locale" ; then
check=`sh -c "locale >/dev/null" 2>&1`
if test -n "$check" ; then
eval ${name}=${save}
eval export ${name}
echo "$whoami tried to use locale $value by setting \$$name" >&2
xmessage -file - <<EOF
$whoami tried unsuccessfully to use locale $value
by setting \$$name to "${value}".
EOF
exit 1
fi
fi
fi
exec $XTERM_PROGRAM -class UXTerm -title $whoami -u8 "$@"