Date: Thu, 23 Sep 2010 20:37:29 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r213085 - stable/8/tools/regression/bin/sh/builtins Message-ID: <201009232037.o8NKbTkv079885@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Thu Sep 23 20:37:29 2010 New Revision: 213085 URL: http://svn.freebsd.org/changeset/base/213085 Log: MFC r212187: sh: Add a test that 'read' leaves the file pointer at the correct place. Naive buffering would break the common while read x... construct, which did not appear to be tested yet. Added: stable/8/tools/regression/bin/sh/builtins/read2.0 - copied unchanged from r212187, head/tools/regression/bin/sh/builtins/read2.0 Modified: Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Copied: stable/8/tools/regression/bin/sh/builtins/read2.0 (from r212187, head/tools/regression/bin/sh/builtins/read2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/read2.0 Thu Sep 23 20:37:29 2010 (r213085, copy of r212187, head/tools/regression/bin/sh/builtins/read2.0) @@ -0,0 +1,31 @@ +# $FreeBSD$ + +set -e +{ + echo 1 + echo two + echo three +} | { + read x + [ "$x" = 1 ] + (read x + [ "$x" = two ]) + read x + [ "$x" = three ] +} + +T=`mktemp sh-test.XXXXXX` +trap 'rm -f "$T"' 0 +{ + echo 1 + echo two + echo three +} >$T +{ + read x + [ "$x" = 1 ] + (read x + [ "$x" = two ]) + read x + [ "$x" = three ] +} <$T
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009232037.o8NKbTkv079885>