Path: utzoo!attcan!uunet!ginosko!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!mailrus!ames!haven!mimsy!chris
From: chris@mimsy.UUCP (Chris Torek)
Newsgroups: comp.unix.questions
Subject: Re: Putting a curses program in the background then in the foreground
Message-ID: <19911@mimsy.UUCP>
Date: 1 Oct 89 06:01:02 GMT
References: <4013@augusta.UUCP> <693@lakart.UUCP>
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 29

In article <693@lakart.UUCP> dg@lakart.UUCP (David Goodenough) writes:
-You need to trap the SIG_TSTP and SIG_CONT signals, and do intelligent
-things in the trap subroutines. It should be noted that vi and the likes
-generally do this.

(The names are SIGTSTP and SIGCONT, and you actually need only trap SIGTSTP.)

-To show ... what ... vi does when starting and stopping ...
-
-% stty raw
-% vi doofus
-# stop the vi with ^Z
-% stty -raw
-% fg
-# stop the vi again
-% stty
-
-You'll find you're back in raw mode. When vi first started, it noted the
-terminal mode, and every time it stops, it resets to that mode. Hence you
-arrive in raw mode after the second stop, rather than -raw mode.

And this is a bug: vi should pick up the new settings when it is resumed,
in case they were changed for a reason (for instance, `stty -tabs' if the
terminal does not in fact handle tabs, or `stty 4800' if the terminal has
severe flow control problems at 9600 baud---perhaps it uses ENQ/ACK flow
control, not available in many kernels).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@cs.umd.edu	Path:	uunet!mimsy!chris