Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!panda!genrad!decvax!decwrl!pyramid!prls!mips!quacky!dce From: dce@quacky.UUCP (David Elliott) Newsgroups: comp.unix.wizards Subject: Re: stuff chars Message-ID: <104@quacky.UUCP> Date: Thu, 4-Dec-86 00:34:05 EST Article-I.D.: quacky.104 Posted: Thu Dec 4 00:34:05 1986 Date-Received: Fri, 5-Dec-86 06:10:25 EST References: <19@houligan.UUCP> <2270@sdcsvax.UCSD.EDU> Reply-To: dce@quacky.UUCP (David Elliott) Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 30 In article <2270@sdcsvax.UCSD.EDU> hutch@sdcsvax.UUCP (Jim Hutchison) writes: >... > >I suggest sending "\n:stop\n" to stop vi, this should circumvent that >flushing problem you get with just sending ^Z to vi and letting it deal >with the intterupt. This also gets around the problem of having the >stop character set to something other than ^Z (heaven forbid! :-) If you look at the code for ex, you will notice that ^Z and :stop are handled in the same way. That is, the onsusp() routine is called, which just resets the SIGTSTP handler to SIG_DFL, and sends a SIGTSTP to the current process. You can't stop a process in BSD Unix without a signal. In other words, the only difference between ^Z and :stop is what you type. The reason to have :stop is so that you can typeahead long before you enter vi. For example, let's say you are executing some command to create a file that you then need to edit. You might execute the original command in the foreground, type in a couple of more commands, type in the vi command, and some vi commands (such as a search for a pattern). At this point, you realize that you will need to read a manual page. If you type ^Z, you stop now and lose the input you typed ahead. If you type :stop, you will enter vi and stop. Loss of typeahead can really be a pain (this makes the Apollo Domain/IX version of vi, and some of the nicer shell line editors not worth using). I have never found a way to change the handling of signals such that input is not flushed. David decwrl!mips!dce