#! /bin/sh # This is the viserver shell script if [ $# -ne 2 ] then echo "Syntax : $0 inpipe outpipe" 1>&2 # message goes to window which is about to disappear # so wait for user to read it and hit return key echo "Hit return to quit" 1>&2 ; read h ; exit 1 fi inpipe=$1 outpipe=$2 # add possible locations of mknod to PATH PATH=/etc:"$PATH" for pipe in "$inpipe" "$outpipe" do if [ ! -p $pipe ] then echo 2>&1 "$pipe is not a named pipe" echo "Hit return to quit" 1>&2 ; read h ; exit 1 fi done # make sure named pipes are removed when server goes away. trap "rm -f $inpipe $outpipe" 0 # Now pipes are set up, go into loop reading filenames from pipe # and editing those files. Indicate when an editing session # is done by writing filename to ouput pipe. # If client sends null filename then shut down server (after # echo filename to outpipe). echo "Starting editing loop" while h=`cat < $inpipe` do if [ "$h" = "" ] then echo "" > $outpipe break fi vi $h # print the edited file in the window for reference cat $h echo $h > $outpipe done