From: Ersek, Laszlo on
In article <n6idnTzM7fBXFezWnZ2dnUVZ_sGdnZ2d(a)supernews.com>, Brian Bebeau <bbebeau(a)computer.org> writes:
> On 2/7/2010 11:43 AM, K-mart Cashier wrote:

>> How would I go about trapping ctrl-c/ctrl-z in this case?

> You need to catch the SIGINT and SIGSTOP signals.

You can't catch SIGSTOP, and that is also not what's generated for the
SUSP character -- you mean SIGTSTP (as in "Terminal SToP", I guess).

http://www.opengroup.org/onlinepubs/007908775/xsh/sigaction.html

----v----
The system will not allow the action for the signals SIGKILL or
SIGSTOP to be set to SIG_IGN.

[...]

The system will not allow a process to catch the signals SIGKILL and
SIGSTOP.
----^----

http://www.opengroup.org/onlinepubs/007908775/xsh/sigprocmask.html

----v----
It is not possible to block those signals which cannot be ignored. [...]
----^----


> term.c_cc[VSTOP] = \032;

I reckon that would be VSUSP; VSTOP is usually ^S.

http://www.opengroup.org/onlinepubs/007908775/xbd/termios.html#tag_008_001_009

----v----
SUSP

If the ISIG flag is set, receipt of the SUSP character causes a SIGTSTP
signal to be sent to all processes in the foreground process group for
which the terminal is the controlling terminal, and the SUSP character
is discarded when processed.

STOP

Special character on both input and output, which is recognised if the
IXON (output control) or IXOFF (input control) flag is set. Can be used
to suspend output temporarily. It is useful with CRT terminals to
prevent output from disappearing before it can be read. If IXON is set,
the STOP character is discarded when processed.
----^----

Cheers,
lacos