Eitan> I also wonder whether the WIN32 really needs to discard the
Eitan> following code fragment.
signal() is supported through the standard libc, but is mostly
ineffective. An example of the kind of code needed is attached.
/* Interrupt handler. mt_exit() is a cleanup_and_exit function */
#ifdef _WIN32
BOOL sigint_handler(DWORD dwCtrlType)
{
mt_exit(3);
return FALSE; /* return value obligatory */
}
#else
void sigint_handler (int sig)
{
mt_exit(3);
}
#endif
/* Catch signals, so we clean up if the child is interrupted.
This emulates "trap ’whatever’ 1 2 15". */
#ifdef _WIN32
SetConsoleCtrlHandler((PHANDLER_ROUTINE)sigint_handler, TRUE);
#else
# ifdef SIGINT
signal (SIGINT, sigint_handler);
# endif
# ifdef SIGHUP
signal (SIGHUP, sigint_handler);
# endif
# ifdef SIGTERM
signal (SIGTERM, sigint_handler);
# endif
#endif