4 trap 'rm -fr $tmpfiles' 1 2 3 15
7 tmpfiles="${p}in.tmp ${p}xout.tmp ${p}out1.tmp ${p}out2.tmp"
9 echo Hello world > ${p}in.tmp
10 echo world > ${p}xout.tmp
12 # Test with seekable stdin; followon process must see remaining data
13 (./test-closein${EXEEXT}; cat) < ${p}in.tmp > ${p}out1.tmp || exit 1
14 cmp ${p}out1.tmp ${p}in.tmp || exit 1
16 (./test-closein${EXEEXT} consume; cat) < ${p}in.tmp > ${p}out2.tmp || exit 1
17 cmp ${p}out2.tmp ${p}xout.tmp || exit 1
19 # Test for lack of error on pipe
20 cat ${p}in.tmp | ./test-closein${EXEEXT} || exit 1
22 cat ${p}in.tmp | ./test-closein${EXEEXT} consume || exit 1
24 # Test for lack of error when nothing is read
25 ./test-closein${EXEEXT} </dev/null || exit 1
27 ./test-closein${EXEEXT} <&- || exit 1
29 # Test for no error when EOF is read early
30 ./test-closein${EXEEXT} consume </dev/null || exit 1
32 # Test for error when read fails because no file available
33 ./test-closein${EXEEXT} consume close <&- 2>/dev/null && exit 1