Path: utzoo!hoptoad!amdcad!pyramid!tub!tmpmbx!altger!dicon!funman!rasasoft
From: rasasoft@funman.UUCP
Newsgroups: alt.sources
Subject: Re: hold -- a program to buffer input
Message-ID: <2200001@funman>
Date: 20 Sep 88 05:34:00 GMT
References: <8082@watdragon.waterloo.edu>
Distribution: alt
Organization: funman systems munich
Lines: 43
Nf-ID: #R:watdragon.waterloo.edu:-808200:funman:2200001:000:1180
Nf-From: funman.UUCP!rasasoft    Sep 20 06:34:00 1988


> twhlai@watdragon.UUCP writes ( 5:14 am  Jul 31, 1988 in funman:ALT.SOURCES): 
> Subject: hold -- a program to buffer input
> A few weeks ago, a program called "hold" was posted to comp.sources.misc that
> buffers its input.  The idea is that something like
>   sed 's/a/b/g' foo > foo
> makes foo a null file, while
>   sed 's/a/b/g' foo | hold foo
> changes all a's to b's in foo, because hold prevents foo from being overwritten
> before sed finishes reading foo.
> 
> Here is a simple Bourne shell script to do this.
> 
> #!/bin/sh
> #
> # This is a shell archive.  Remove anything before this line,
> # then unpack it by saving it in a file and typing "sh file".
> #
> # The files contained herein are:
> #  hold
> #
> echo 'extracting hold'
> if test -f hold; then echo 'shar: not overwriting hold'; else
> sed 's/^X//' << 'EOF' > hold
> X#!/bin/sh
> Xif [ $# -gt 1 ]
> Xthen
> X  echo 'Usage: hold [file]' 1>&2
> X  exit 1
> Xfi
> Xf=/tmp/hold.$$
> Xcat > $f
> Xcase $# in
> X0) cat $f ;;
> X1) cat $f > $1
> Xesac
> X/bin/rm -f $f
> EOF
> if test `wc -c < hold` -ne 158; then
> echo 'shar: hold was damaged during transit (should have been 158 bytes)'
> fi
> fi
> exit 0