This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Allow to send SIGQUIT via Ctrl+BREAK (patch included)
- From: Christian Franke <Christian dot Franke at t-online dot de>
- To: cygwin-patches at cygwin dot com
- Date: Thu, 24 Nov 2005 23:03:02 +0100
- Subject: Allow to send SIGQUIT via Ctrl+BREAK (patch included)
Hi,
unlike Linux & friends, Cygwin cannot send a SIGQUIT via keyboard.
The SIGQUIT key simulated in termios does only work if app reads from
console.
Both console events ^C and ^BREAK are mapped to SIGINT.
Suggest to add some option to send SIGQUIT via ^BREAK.
A simple patch is attached.
It sends SIGQUIT on ^BREAK if both VINTR and VQUIT are set to ^C.
As a positive side effect, this disables any other SIGQUIT key in termios.
Testcase:
$ sleep 1000
[^BREAK]
$ ./stty quit ^C
$ sleep 1000
[^BREAK]
Quit (core dumped)
$ ./stty quit ^X
$ sleep 1000
[^BREAK]
$ echo Thanks for any comment
Thanks for any comment
Christian
--- exceptions.cc.orig 2005-07-01 17:49:40.001000000 +0200
+++ exceptions.cc 2005-11-24 22:41:02.765867700 +0100
@@ -888,8 +888,13 @@
that we have handled the signal). At this point, type should be
a CTRL_C_EVENT or CTRL_BREAK_EVENT. */
{
+ int sig = SIGINT;
+ /* If intr and quit are both mapped to ^C, send SIGQUIT on ^BREAK */
+ if (type == CTRL_BREAK_EVENT
+ && t->ti.c_cc[VINTR] == 3 && t->ti.c_cc[VQUIT] == 3)
+ sig = SIGQUIT;
t->last_ctrl_c = GetTickCount ();
- killsys (-myself->pid, SIGINT);
+ killsys (-myself->pid, sig);
t->last_ctrl_c = GetTickCount ();
return TRUE;
}