]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - tools/regression/bin/sh/builtins/read5.0
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / tools / regression / bin / sh / builtins / read5.0
1 # $FreeBSD$
2
3 unset LC_ALL
4 LC_CTYPE=en_US.ISO8859-1
5 export LC_CTYPE
6
7 # Note: the first and last characters are not whitespace.
8 # Exclude backslash and newline.
9 bad1=`printf %03o \'\\\\`
10 bad2=`printf %03o \''
11 '`
12 e=
13 for i in 0 1 2 3; do
14         for j in 0 1 2 3 4 5 6 7; do
15                 for k in 0 1 2 3 4 5 6 7; do
16                         case $i$j$k in
17                         000|$bad1|$bad2) continue ;;
18                         esac
19                         e="$e\\$i$j$k"
20                 done
21         done
22 done
23 e=`printf "$e"`
24 [ "${#e}" = 253 ] || echo length bad
25
26 r1=`printf '%s\n' "$e" | { read -r x; printf '%s' "$x"; }`
27 [ "$r1" = "$e" ] || echo "read with -r bad"
28 r2=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }`
29 [ "$r2" = "$e" ] || echo "read without -r bad 1"
30 IFS=
31 r3=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }`
32 [ "$r3" = "$e" ] || echo "read without -r bad 2"