: ' : A program to cause vi to fill its buffer from standard input through : a (high speed) named pipe. This will work on system V and SUN 3.x unix : For systems where the named pipe can not be created, a TMP file will be : used with corresponding lack of efficiency. Vi will read its command : input from /dev/tty. : : Usage: pvi [-f|-u] [viflags] : -f forces the use of a file rather than a named pipe : -u implies -f but causes the cat to run unbuffered (-u) : viflags are passed to vi after the -R (read-only) flag : : Usage example: co -p foo | pvi : : Author: Corey Satten, Corey@fluke, 5/7/87 : http://staff.washington.edu/corey : ' TMP=/tmp/pipe$$; cat=/bin/cat; mknod=/etc/mknod; rm=/bin/rm trap "$rm -f $TMP; exit 0" 0 1 2 13 15 case "$1" in -f) FFLAG=1; shift;; -u) FFLAG=1; CATFLAG=-u; shift;; *) $mknod $TMP p >/dev/null 2>&1;; esac # Doesn't seem to return a useful status if [ -w $TMP -a -z "$FFLAG" ] ;then exec 4<&0 # Extreme wizardry, (copy stdin to FD #4) $cat <&4 > $TMP & # so that cat can run in the background vi -R ${1+"$@"} $TMP $TMP # Can't make the pipe? Just use a file. vi -R ${1+"$@"} $TMP