xref: /freebsd/bin/sh/tests/builtins/read5.0 (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1*13de33a5SJulio Merino
2*13de33a5SJulio Merinounset LC_ALL
3*13de33a5SJulio MerinoLC_CTYPE=en_US.ISO8859-1
4*13de33a5SJulio Merinoexport LC_CTYPE
5*13de33a5SJulio Merino
6*13de33a5SJulio Merino# Note: the first and last characters are not whitespace.
7*13de33a5SJulio Merino# Exclude backslash and newline.
8*13de33a5SJulio Merinobad1=`printf %03o \'\\\\`
9*13de33a5SJulio Merinobad2=`printf %03o \''
10*13de33a5SJulio Merino'`
11*13de33a5SJulio Merinoe=
12*13de33a5SJulio Merinofor i in 0 1 2 3; do
13*13de33a5SJulio Merino	for j in 0 1 2 3 4 5 6 7; do
14*13de33a5SJulio Merino		for k in 0 1 2 3 4 5 6 7; do
15*13de33a5SJulio Merino			case $i$j$k in
16*13de33a5SJulio Merino			000|$bad1|$bad2) continue ;;
17*13de33a5SJulio Merino			esac
18*13de33a5SJulio Merino			e="$e\\$i$j$k"
19*13de33a5SJulio Merino		done
20*13de33a5SJulio Merino	done
21*13de33a5SJulio Merinodone
22*13de33a5SJulio Merinoe=`printf "$e"`
23*13de33a5SJulio Merino[ "${#e}" = 253 ] || echo length bad
24*13de33a5SJulio Merino
25*13de33a5SJulio Merinor1=`printf '%s\n' "$e" | { read -r x; printf '%s' "$x"; }`
26*13de33a5SJulio Merino[ "$r1" = "$e" ] || echo "read with -r bad"
27*13de33a5SJulio Merinor2=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }`
28*13de33a5SJulio Merino[ "$r2" = "$e" ] || echo "read without -r bad 1"
29*13de33a5SJulio MerinoIFS=
30*13de33a5SJulio Merinor3=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }`
31*13de33a5SJulio Merino[ "$r3" = "$e" ] || echo "read without -r bad 2"
32