Mail Archives: djgpp/2000/02/09/06:11:34
On Tue, 8 Feb 2000, Antti Koskipää wrote:
> I'm working on a little program (18000+ lines of code already =)
> and I want to disable Ctrl-C trapping. With _go32_want_ctrl_break()
> I can disable Ctrl-Break. Great. But when I press Ctrl-C, the program
> bombs with quadruple faults.
I suggest to forget about `_go32_want_ctrl_break', it's there only for
back-compatibility. Use the library function `signal' to install a
handler for the SIGINT signal, and it will catch both Ctrl-C and
Ctrl-BREAK. If your handler returns, the program will continue.
> If I shell out from the proggy, press Ctrl-C on the command line
> (DOS prints the ^C and a CR) and type exit to return, the program
> crashes again. This is ridiculous!
Why ridiculous? This is intended behavior: SIGINT is passed to all
the parent processes. The motivation is compatibility with Unix,
where signals are always passed to the parents. If the parent process
wants to ignore SIGINT's while the child runs, it needs to reset
SIGINT hadnling to SIG_IGN, or install a handler that simply returns.
> Is there any way to disable Ctrl-C from causing an exception other than
> writing my own keyboard handler?
Yes, by reading the fine docs ;-).
- Raw text -