sh: Sync with FreeBSD:
[dragonfly.git] / tools / regression / bin / sh / parser / func1.0
1 # $FreeBSD: head/tools/regression/bin/sh/parser/func1.0 214291 2010-10-24 20:45:13Z jilles $
2 # POSIX does not require these bytes to work in function names,
3 # but making them all work seems a good goal.
4
5 failures=0
6 unset LC_ALL
7 export LC_CTYPE=en_US.ISO8859-1
8 i=128
9 set -f
10 while [ "$i" -le 255 ]; do
11         c=$(printf \\"$(printf %o "$i")")
12         ok=0
13         eval "$c() { ok=1; }"
14         $c
15         ok1=$ok
16         ok=0
17         "$c"
18         if [ "$ok" != 1 ] || [ "$ok1" != 1 ]; then
19                 echo "Bad results for character $i" >&2
20                 : $((failures += 1))
21         fi
22         unset -f $c
23         i=$((i+1))
24 done
25 exit $((failures > 0))