Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!lavaca.uh.edu!uhnix1!sugar!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Newsgroups: comp.unix.questions Subject: Re: Sharing Open File Current Offset? (Looking for example of applications) Keywords: Files Message-ID: Date: 21 Aug 90 17:55:06 GMT References: <6011@chorus.fr> Organization: Xenix Support, FICC Lines: 33 In article <6011@chorus.fr>, francois@chorus.fr (Francois Armand) writes: > I am looking for some _real_ _uses_ of current offset sharing > by real applications running on any flavor of UNIX systems. Here's one from a script I use in mail handling: { echo "An error occurred on `net lname` while attempting to forward mail." echo "It was not possible to forward the mail to $SYS for further handling." echo "(it is possible that $SYS was down, or temporarily off the network," echo " so please try again in a few minutes)" echo "" echo "Your mail was not delivered to $USERS" if [ -s $TMP ] then echo "" echo "The following messages were returned from the delivery program:" echo "==========" cat $TMP echo "==========" fi echo "" echo "Here are the contents of the lost mail:" echo "==========" cat } > /tmp/err$$ > I have never seen any program using this property! Now you have. It's used all over in shell scripts. In fact, in Version 6 UNIX this is how control structures in shell scripts were implemented: "if" and so on were loadable programs, that seeked on the open file descriptor for the script looking for labels. -- Peter da Silva. `-_-' +1 713 274 5180. 'U` peter@ferranti.com