diff options
author | ru <ru@FreeBSD.org> | 2000-01-17 10:50:35 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2000-01-17 10:50:35 +0000 |
commit | 31780e6c3d08f84120b67f92277c1665d6996f0b (patch) | |
tree | d64ebb0e6970264f24407e00171615ccbaf56c95 /contrib/texinfo/info | |
parent | 42d2eadf22ded3812cf4afbf88eec539bcdbda12 (diff) | |
download | FreeBSD-src-31780e6c3d08f84120b67f92277c1665d6996f0b.zip FreeBSD-src-31780e6c3d08f84120b67f92277c1665d6996f0b.tar.gz |
Merge our changes into GNU texinfo 4.0
Diffstat (limited to 'contrib/texinfo/info')
-rw-r--r-- | contrib/texinfo/info/signals.c | 100 |
1 files changed, 68 insertions, 32 deletions
diff --git a/contrib/texinfo/info/signals.c b/contrib/texinfo/info/signals.c index 16e87f0..954a739 100644 --- a/contrib/texinfo/info/signals.c +++ b/contrib/texinfo/info/signals.c @@ -1,9 +1,8 @@ -/* signals.c -- Install and maintain Info signal handlers. */ +/* signals.c -- install and maintain Info signal handlers. + $Id: signals.c,v 1.6 1998/12/06 22:00:04 karl Exp $ + $FreeBSD$ -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 98 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +29,9 @@ /* */ /* **************************************************************** */ +/* Non-zero when our signal handler has been called to handle SIGWINCH. */ +static int in_sigwinch = 0; + #if !defined (HAVE_SIGPROCMASK) && defined (HAVE_SIGSETMASK) /* Perform OPERATION on NEWSET, perhaps leaving information in OLDSET. */ static void @@ -66,7 +68,7 @@ typedef RETSIGTYPE signal_handler (); static RETSIGTYPE info_signal_handler (); static signal_handler *old_TSTP, *old_TTOU, *old_TTIN; -static signal_handler *old_WINCH, *old_INT, *old_CONT; +static signal_handler *old_WINCH, *old_INT, *old_USR1, *old_CONT; void initialize_info_signal_handler () @@ -81,12 +83,17 @@ initialize_info_signal_handler () old_WINCH = (signal_handler *) signal (SIGWINCH, info_signal_handler); #if defined (SIGCONT) old_CONT = (signal_handler *) signal (SIGCONT, info_signal_handler); -#endif /* SIGCONT */ +#endif #endif #if defined (SIGINT) old_INT = (signal_handler *) signal (SIGINT, info_signal_handler); #endif + +#if defined (SIGUSR1) + /* Used by DJGPP to simulate SIGTSTP on Ctrl-Z. */ + old_USR1 = (signal_handler *) signal (SIGUSR1, info_signal_handler); +#endif } static void @@ -100,6 +107,19 @@ redisplay_after_signal () fflush (stdout); } +static void +reset_info_window_sizes () +{ + terminal_goto_xy (0, 0); + fflush (stdout); + terminal_unprep_terminal (); + terminal_get_screen_size (); + terminal_prep_terminal (); + display_initialize_display (screenwidth, screenheight); + window_new_screen_size (screenwidth, screenheight, NULL); + redisplay_after_signal (); +} + static RETSIGTYPE info_signal_handler (sig) int sig; @@ -148,37 +168,53 @@ info_signal_handler (sig) } break; -#if defined (SIGWINCH) -#if defined(SIGCONT) +#if defined (SIGWINCH) || defined (SIGUSR1) +#ifdef SIGWINCH +#ifdef SIGCONT case SIGCONT: - if (old_CONT) - (void)(old_CONT)(sig); /* pretend a SIGWINCH in case the terminal window size has changed while we've been asleep */ - /* FALLTROUGH */ -#endif /* defined(SIGCONT) */ - + /* FALLTHROUGH */ +#endif case SIGWINCH: +#endif +#ifdef SIGUSR1 + case SIGUSR1: +#endif { - /* Turn off terminal IO, tell our parent that the window has changed, - then reinitialize the terminal and rebuild our windows. */ - old_signal_handler = &old_WINCH; - terminal_goto_xy (0, 0); - fflush (stdout); - terminal_unprep_terminal (); - signal (sig, *old_signal_handler); - UNBLOCK_SIGNAL (sig); - kill (getpid (), sig); - - /* After our old signal handler returns... */ - terminal_get_screen_size (); - terminal_prep_terminal (); - display_initialize_display (screenwidth, screenheight); - window_new_screen_size (screenwidth, screenheight, (VFunction *)NULL); - *old_signal_handler = (signal_handler *) signal (sig, info_signal_handler); - redisplay_after_signal (); + if (!in_sigwinch) { + in_sigwinch++; + + /* Turn off terminal IO, tell our parent that the window has changed, + then reinitialize the terminal and rebuild our windows. */ +#ifdef SIGWINCH + if (sig == SIGWINCH) + old_signal_handler = &old_WINCH; +#ifdef SIGCONT + else if (sig == SIGCONT) + old_signal_handler = &old_CONT; +#endif +#endif +#ifdef SIGUSR1 + if (sig == SIGUSR1) + old_signal_handler = &old_USR1; +#endif + terminal_goto_xy (0, 0); + fflush (stdout); + terminal_unprep_terminal (); + signal (sig, *old_signal_handler); + UNBLOCK_SIGNAL (sig); + kill (getpid (), sig); + + /* After our old signal handler returns... */ + *old_signal_handler + = (signal_handler *) signal (sig, info_signal_handler); + terminal_prep_terminal (); + reset_info_window_sizes (); + in_sigwinch--; + } } break; -#endif /* SIGWINCH */ +#endif /* SIGWINCH || SIGUSR1 */ } } |