version 1.6, 2000/07/20 14:00:01
|
version 1.14, 2002/01/14 08:40:24
|
Line 1
|
Line 1
|
/* signal handling |
/* signal handling |
|
|
Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. |
Copyright (C) 1995,1996,1997,1998,2000 Free Software Foundation, Inc. |
|
|
This file is part of Gforth. |
This file is part of Gforth. |
|
|
Line 16
|
Line 16
|
|
|
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
along with this program; if not, write to the Free Software |
along with this program; if not, write to the Free Software |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. |
|
|
*/ |
*/ |
|
|
Line 47
|
Line 47
|
UCell cols=DEFAULTCOLS; |
UCell cols=DEFAULTCOLS; |
UCell rows=DEFAULTROWS; |
UCell rows=DEFAULTROWS; |
|
|
|
#ifndef SA_NODEFER |
|
#define SA_NODEFER 0 |
|
/* systems that don't have SA_NODEFER hopefully don't block anyway */ |
|
#endif |
|
|
#ifdef SA_SIGINFO |
#ifdef SA_SIGINFO |
void install_signal_handler(int sig, void (*handler)(int, siginfo_t *, void *)) |
void install_signal_handler(int sig, void (*handler)(int, siginfo_t *, void *)) |
/* installs three-argument signal handler for sig */ |
/* installs three-argument signal handler for sig */ |
Line 158 static void segv_handler(int sig, siginf
|
Line 163 static void segv_handler(int sig, siginf
|
#endif /* defined(SA_SIGINFO) */ |
#endif /* defined(SA_SIGINFO) */ |
|
|
#ifdef SIGCONT |
#ifdef SIGCONT |
static void termprep (int sig) |
static void termprep(int sig) |
{ |
{ |
bsd_signal(sig,termprep); |
bsd_signal(sig,termprep); |
terminal_prepped=0; |
terminal_prepped=0; |
Line 169 void get_winsize()
|
Line 174 void get_winsize()
|
{ |
{ |
#ifdef TIOCGWINSZ |
#ifdef TIOCGWINSZ |
struct winsize size; |
struct winsize size; |
|
size.ws_row = size.ws_col = 0; |
|
|
if (ioctl (1, TIOCGWINSZ, (char *) &size) >= 0) { |
if (ioctl (1, TIOCGWINSZ, (char *) &size) >= 0) { |
rows = size.ws_row; |
rows = size.ws_row; |
Line 178 void get_winsize()
|
Line 184 void get_winsize()
|
char *s; |
char *s; |
if ((s=getenv("LINES"))) { |
if ((s=getenv("LINES"))) { |
rows=atoi(s); |
rows=atoi(s); |
if (rows==0) |
|
rows=DEFAULTROWS; |
|
} |
} |
if ((s=getenv("COLUMNS"))) { |
if ((s=getenv("COLUMNS"))) { |
rows=atoi(s); |
rows=atoi(s); |
if (rows==0) |
|
cols=DEFAULTCOLS; |
|
} |
} |
#endif |
#endif |
|
if (rows==0) |
|
rows=DEFAULTROWS; |
|
if (rows==0) |
|
cols=DEFAULTCOLS; |
} |
} |
|
|
#ifdef SIGWINCH |
#ifdef SIGWINCH |
Line 361 void install_signal_handlers(void)
|
Line 367 void install_signal_handlers(void)
|
for (i = 0; i < DIM (sigs_to_quit); i++) |
for (i = 0; i < DIM (sigs_to_quit); i++) |
bsd_signal(sigs_to_quit [i], graceful_exit); |
bsd_signal(sigs_to_quit [i], graceful_exit); |
#ifdef SA_SIGINFO |
#ifdef SA_SIGINFO |
install_signal_handler(SIGFPE, fpe_handler); |
if (!die_on_signal) { |
install_signal_handler(SIGSEGV, segv_handler); |
install_signal_handler(SIGFPE, fpe_handler); |
|
install_signal_handler(SIGSEGV, segv_handler); |
|
} |
#endif |
#endif |
#ifdef SIGCONT |
#ifdef SIGCONT |
bsd_signal(SIGCONT, termprep); |
bsd_signal(SIGCONT, termprep); |