locale revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
tst - note{ canonical UTF-8 name }end run{
ifs=$IFS
str=
sys=
for i in `PATH=/bin:/usr/bin:$PATH locale -a | grep -i '^[^C].*\.UTF[-8]*$'`
do IFS=.
set '' $i
IFS=$ifs
case $3 in
UTF-8) str=$3
break
;;
*) if $SHELL -c "LC_CTYPE=$2.UTF-8 PATH=/bin:/usr/bin:$PATH locale LC_CTYPE | grep -i utf.*8" >/dev/null 2>&1
then str=UTF-8
break
fi
;;
esac
sys=$3
done
case $str in
'') str=$sys ;;
esac
case $str in
'') echo "#define _locale_utf8_str 0" ;;
*) echo "#define _locale_utf8_str \"$str\"" ;;
esac
}end