version 1.1, 1999/02/28 08:37:45
|
version 1.2, 1999/02/28 14:50:44
|
Line 24
|
Line 24
|
#define _GNU_SOURCE |
#define _GNU_SOURCE |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <signal.h> |
|
#include <setjmp.h> |
#include <setjmp.h> |
#include <string.h> |
#include <string.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#if !defined(apollo) && !defined(MSDOS) |
#if !defined(apollo) && !defined(MSDOS) |
#include <sys/ioctl.h> |
#include <sys/ioctl.h> |
#endif |
#endif |
|
/* #include <asm/signal.h> */ |
|
#include <signal.h> |
#include "config.h" |
#include "config.h" |
#include "forth.h" |
#include "forth.h" |
#include "io.h" |
#include "io.h" |
Line 123 static void change_winsize(int sig)
|
Line 124 static void change_winsize(int sig)
|
} |
} |
#endif |
#endif |
|
|
void install_signal_handlers (void) |
void install_signal_handler(int sig, void (*simple_handler)(), void (*complex_handler)()) |
|
/* installs signal handler for sig. If the system has the |
|
necessary support, complex_handler will be invoked upon |
|
receipt of a signal, otherwise simple_handler. */ |
|
{ |
|
#ifdef SA_SIGINFO |
|
struct sigaction action; |
|
|
|
action.sa_handler=simple_handler; |
|
action.sa_sigaction=complex_handler; |
|
sigemptyset(&action.sa_mask); |
|
action.sa_flags=SA_SIGINFO; /* use complex_handler */ |
|
sigaction(sig, action, NULL); |
|
#else |
|
/* ANSI C */ |
|
signal(sig,simple_handler); |
|
#endif |
|
} |
|
|
|
void install_signal_handlers(void) |
{ |
{ |
|
|
#if 0 |
#if 0 |
Line 273 void install_signal_handlers (void)
|
Line 293 void install_signal_handlers (void)
|
#endif |
#endif |
}; |
}; |
int i; |
int i; |
|
void (*throw_handler)() = die_on_signal ? graceful_exit : signal_throw; |
|
|
#define DIM(X) (sizeof (X) / sizeof *(X)) |
#define DIM(X) (sizeof (X) / sizeof *(X)) |
/* |
/* |
Line 280 void install_signal_handlers (void)
|
Line 301 void install_signal_handlers (void)
|
signal (sigs_to_ignore [i], SIG_IGN); |
signal (sigs_to_ignore [i], SIG_IGN); |
*/ |
*/ |
for (i = 0; i < DIM (sigs_to_throw); i++) |
for (i = 0; i < DIM (sigs_to_throw); i++) |
signal (sigs_to_throw [i], die_on_signal ? graceful_exit : signal_throw); |
install_signal_handler(sigs_to_throw [i], throw_handler, throw_handler); |
for (i = 0; i < DIM (sigs_to_quit); i++) |
for (i = 0; i < DIM (sigs_to_quit); i++) |
signal (sigs_to_quit [i], graceful_exit); |
signal (sigs_to_quit [i], graceful_exit); |
#ifdef SIGCONT |
#ifdef SIGCONT |