version 1.14, 1996/01/25 16:45:52
|
version 1.16, 1996/09/19 22:17:32
|
Line 45
|
Line 45
|
#include "forth.h" |
#include "forth.h" |
#include "io.h" |
#include "io.h" |
|
|
|
#ifndef MSDOS |
#if defined (__GNUC__) |
#if defined (__GNUC__) |
# define alloca __builtin_alloca |
# define alloca __builtin_alloca |
#else |
#else |
Line 111
|
Line 112
|
#endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */ |
#endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */ |
|
|
#include <errno.h> |
#include <errno.h> |
extern int errno; |
/* extern int errno; */ |
|
|
#if defined (SHELL) |
#if defined (SHELL) |
# include <posixstat.h> |
# include <posixstat.h> |
Line 283 void prep_terminal ()
|
Line 284 void prep_terminal ()
|
if (terminal_prepped) |
if (terminal_prepped) |
return; |
return; |
|
|
|
if (!isatty(tty)) { /* added by MdG */ |
|
terminal_prepped = 1; /* added by MdG */ |
|
return; /* added by MdG */ |
|
} /* added by MdG */ |
|
|
oldmask = sigblock (sigmask (SIGINT)); |
oldmask = sigblock (sigmask (SIGINT)); |
|
|
/* We always get the latest tty values. Maybe stty changed them. */ |
/* We always get the latest tty values. Maybe stty changed them. */ |
Line 389 void deprep_terminal ()
|
Line 395 void deprep_terminal ()
|
if (!terminal_prepped) |
if (!terminal_prepped) |
return; |
return; |
|
|
|
/* Added by MdG */ |
|
if (!isatty(tty)) { |
|
terminal_prepped = 0; |
|
return; |
|
} |
|
|
oldmask = sigblock (sigmask (SIGINT)); |
oldmask = sigblock (sigmask (SIGINT)); |
|
|
the_ttybuff.sg_flags = original_tty_flags; |
the_ttybuff.sg_flags = original_tty_flags; |
Line 443 void prep_terminal ()
|
Line 455 void prep_terminal ()
|
if (terminal_prepped) |
if (terminal_prepped) |
return; |
return; |
|
|
|
if (!isatty(tty)) { /* added by MdG */ |
|
terminal_prepped = 1; /* added by MdG */ |
|
return; /* added by MdG */ |
|
} /* added by MdG */ |
|
|
/* Try to keep this function from being INTerrupted. We can do it |
/* Try to keep this function from being INTerrupted. We can do it |
on POSIX and systems with BSD-like signal handling. */ |
on POSIX and systems with BSD-like signal handling. */ |
#if defined (HAVE_POSIX_SIGNALS) |
#if defined (HAVE_POSIX_SIGNALS) |
Line 547 void deprep_terminal ()
|
Line 564 void deprep_terminal ()
|
if (!terminal_prepped) |
if (!terminal_prepped) |
return; |
return; |
|
|
|
/* Added by MdG */ |
|
if (!isatty(tty)) { |
|
terminal_prepped = 0; |
|
return; |
|
} |
|
|
#if defined (HAVE_POSIX_SIGNALS) |
#if defined (HAVE_POSIX_SIGNALS) |
sigemptyset (&set); |
sigemptyset (&set); |
sigemptyset (&oset); |
sigemptyset (&oset); |
Line 693 int main()
|
Line 716 int main()
|
puts(""); |
puts(""); |
} |
} |
#endif |
#endif |
|
#endif /* MSDOS */ |
|
|
/* signal handling adapted from pfe by Dirk Zoller (Copylefted) - anton */ |
/* signal handling adapted from pfe by Dirk Zoller (Copylefted) - anton */ |
|
|
Line 717 signal_throw(int sig)
|
Line 740 signal_throw(int sig)
|
} *p, throwtable[] = { |
} *p, throwtable[] = { |
{ SIGINT, -28 }, |
{ SIGINT, -28 }, |
{ SIGFPE, -55 }, |
{ SIGFPE, -55 }, |
|
#ifdef SIGBUS |
{ SIGBUS, -23 }, |
{ SIGBUS, -23 }, |
|
#endif |
{ SIGSEGV, -9 }, |
{ SIGSEGV, -9 }, |
}; |
}; |
signal(sig,signal_throw); |
signal(sig,signal_throw); |
Line 729 signal_throw(int sig)
|
Line 754 signal_throw(int sig)
|
longjmp(throw_jmp_buf,code); /* or use siglongjmp ? */ |
longjmp(throw_jmp_buf,code); /* or use siglongjmp ? */ |
} |
} |
|
|
|
UCell cols=80; |
|
#ifdef MSDOS |
|
UCell rows=25; |
|
#else |
|
UCell rows=24; |
|
#endif |
|
|
|
#ifdef SIGCONT |
static void termprep (int sig) |
static void termprep (int sig) |
{ |
{ |
signal(sig,termprep); |
signal(sig,termprep); |
terminal_prepped=0; |
terminal_prepped=0; |
} |
} |
|
#endif |
|
|
UCell rows=24; |
#ifdef SIGWINCH |
UCell cols=80; |
|
|
|
void get_winsize() |
void get_winsize() |
{ |
{ |
#ifdef TIOCGWINSZ |
#ifdef TIOCGWINSZ |
Line 770 static void change_winsize(int sig)
|
Line 802 static void change_winsize(int sig)
|
get_winsize(); |
get_winsize(); |
#endif |
#endif |
} |
} |
|
#endif |
|
|
void install_signal_handlers (void) |
void install_signal_handlers (void) |
{ |
{ |