summaryrefslogtreecommitdiff
path: root/src/lib/libast/features/locale
blob: ffd19889ab9bbf23a2b16764f6f1d3059e17466b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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