Commit a71f8523 authored by sewardj's avatar sewardj
Browse files

[project @ 2000-06-28 10:42:17 by sewardj]

Partially fix signal (control-C) handling under mingw32.
The interpreter can now be interrupted and successfully returns to
the Hugs prompt, but only if Hugs was started from cmd.exe and not
by bash (!).  This is a known bogon with Cygwin, according to
Sigbjorn.  I still can't get Hugs to ignore other control-C's;
instead it acts as if it was asked to exit.  Bizarre.
parent 365a3d9d
......@@ -9,8 +9,8 @@
* included in the distribution.
*
* $RCSfile: connect.h,v $
* $Revision: 1.43 $
* $Date: 2000/05/26 10:14:33 $
* $Revision: 1.44 $
* $Date: 2000/06/28 10:42:17 $
* ------------------------------------------------------------------------*/
/* --------------------------------------------------------------------------
......@@ -578,7 +578,9 @@ extern HugsBreakAction setBreakAction ( HugsBreakAction );
#else
#define setHandler(bh) do { } while(0)
#define setHandler(bh) { void* old_hdlr = signal(SIGINT,bh);\
if (old_hdlr == SIG_ERR) internal("setHandler"); \
}
#endif /* !defined(mingw32_TARGET_OS) */
......
......@@ -9,8 +9,8 @@
* included in the distribution.
*
* $RCSfile: hugs.c,v $
* $Revision: 1.77 $
* $Date: 2000/06/23 12:09:01 $
* $Revision: 1.78 $
* $Date: 2000/06/28 10:42:17 $
* ------------------------------------------------------------------------*/
#include <setjmp.h>
......@@ -873,6 +873,18 @@ HugsBreakAction setBreakAction ( HugsBreakAction newAction )
{
HugsBreakAction tmp = currentBreakAction;
currentBreakAction = newAction;
# if defined(mingw32_TARGET_OS)
/* Be wierd. You can't longjmp in a signal handler,
and posix signals are not supported.
*/
if (newAction == HugsRtsInterrupt) {
setHandler ( handler_RtsInterrupt );
} else {
signal(SIGINT,SIG_IGN);
}
# else
/* do it Right */
switch (newAction) {
case HugsIgnoreBreak:
setHandler ( handler_IgnoreBreak ); break;
......@@ -883,6 +895,8 @@ HugsBreakAction setBreakAction ( HugsBreakAction newAction )
default:
internal("setBreakAction");
}
# endif
return tmp;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment