Putting a curses program in the background then in the foreground

Leo de Wit leo at philmds.UUCP
Fri Sep 22 21:01:56 AEST 1989


In article <BRISTER.89Sep21161941 at aries.td2cad.intel.com> brister at td2cad.intel.com (James Brister) writes:
|My guess about this sort of required behaviour is this:
|
|	i) the program catches the SIGTSTP signal. In the handler it reset the
|	   terminal characteristics and then sends itself a SIGSTOP.
|
|        ii) the program catches the SIGCONT signal. In the handler it does a
|	   refresh of the necessary stuff and then continues.
|
|There's probably a few minor :-) details in there that need to be added. Comments?

This will work, but the program does not need to catch SIGCONT. When
the program resumes, it will continue after the kill() in the SIGTSTP
handler. So there you can do the refresh, and set the terminal
characteristics back (if you DO catch SIGCONT, that handler is called
first, then the SIGTSTP handler continues).

On a side note, I think it is generally a bad idea to do much stuff in
a signal handler, especially if that involves accessing global data
other than a flag (for instance, you can easily screw up stdio).

    Leo.



More information about the Comp.unix.questions mailing list