Putting a curses program in the background then in the foreground

Chris Torek chris at mimsy.UUCP
Sun Oct 1 16:01:02 AEST 1989


In article <693 at lakart.UUCP> dg at 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 at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.questions mailing list