Merge our changes into GNU texinfo 4.0
This commit is contained in:
parent
980e0006ad
commit
afbbfd9124
@ -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
|
Copyright (C) 1993, 94, 95, 98 Free Software Foundation, Inc.
|
||||||
stored in Info format.
|
|
||||||
|
|
||||||
Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
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)
|
#if !defined (HAVE_SIGPROCMASK) && defined (HAVE_SIGSETMASK)
|
||||||
/* Perform OPERATION on NEWSET, perhaps leaving information in OLDSET. */
|
/* Perform OPERATION on NEWSET, perhaps leaving information in OLDSET. */
|
||||||
static void
|
static void
|
||||||
@ -66,7 +68,7 @@ typedef RETSIGTYPE signal_handler ();
|
|||||||
|
|
||||||
static RETSIGTYPE info_signal_handler ();
|
static RETSIGTYPE info_signal_handler ();
|
||||||
static signal_handler *old_TSTP, *old_TTOU, *old_TTIN;
|
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
|
void
|
||||||
initialize_info_signal_handler ()
|
initialize_info_signal_handler ()
|
||||||
@ -81,12 +83,17 @@ initialize_info_signal_handler ()
|
|||||||
old_WINCH = (signal_handler *) signal (SIGWINCH, info_signal_handler);
|
old_WINCH = (signal_handler *) signal (SIGWINCH, info_signal_handler);
|
||||||
#if defined (SIGCONT)
|
#if defined (SIGCONT)
|
||||||
old_CONT = (signal_handler *) signal (SIGCONT, info_signal_handler);
|
old_CONT = (signal_handler *) signal (SIGCONT, info_signal_handler);
|
||||||
#endif /* SIGCONT */
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (SIGINT)
|
#if defined (SIGINT)
|
||||||
old_INT = (signal_handler *) signal (SIGINT, info_signal_handler);
|
old_INT = (signal_handler *) signal (SIGINT, info_signal_handler);
|
||||||
#endif
|
#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
|
static void
|
||||||
@ -100,6 +107,19 @@ redisplay_after_signal ()
|
|||||||
fflush (stdout);
|
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
|
static RETSIGTYPE
|
||||||
info_signal_handler (sig)
|
info_signal_handler (sig)
|
||||||
int sig;
|
int sig;
|
||||||
@ -148,37 +168,53 @@ info_signal_handler (sig)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined (SIGWINCH)
|
#if defined (SIGWINCH) || defined (SIGUSR1)
|
||||||
#if defined(SIGCONT)
|
#ifdef SIGWINCH
|
||||||
|
#ifdef SIGCONT
|
||||||
case SIGCONT:
|
case SIGCONT:
|
||||||
if (old_CONT)
|
|
||||||
(void)(old_CONT)(sig);
|
|
||||||
/* pretend a SIGWINCH in case the terminal window size has changed
|
/* pretend a SIGWINCH in case the terminal window size has changed
|
||||||
while we've been asleep */
|
while we've been asleep */
|
||||||
/* FALLTROUGH */
|
/* FALLTHROUGH */
|
||||||
#endif /* defined(SIGCONT) */
|
#endif
|
||||||
|
|
||||||
case SIGWINCH:
|
case SIGWINCH:
|
||||||
|
#endif
|
||||||
|
#ifdef SIGUSR1
|
||||||
|
case SIGUSR1:
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
/* Turn off terminal IO, tell our parent that the window has changed,
|
if (!in_sigwinch) {
|
||||||
then reinitialize the terminal and rebuild our windows. */
|
in_sigwinch++;
|
||||||
old_signal_handler = &old_WINCH;
|
|
||||||
terminal_goto_xy (0, 0);
|
/* Turn off terminal IO, tell our parent that the window has changed,
|
||||||
fflush (stdout);
|
then reinitialize the terminal and rebuild our windows. */
|
||||||
terminal_unprep_terminal ();
|
#ifdef SIGWINCH
|
||||||
signal (sig, *old_signal_handler);
|
if (sig == SIGWINCH)
|
||||||
UNBLOCK_SIGNAL (sig);
|
old_signal_handler = &old_WINCH;
|
||||||
kill (getpid (), sig);
|
#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... */
|
/* After our old signal handler returns... */
|
||||||
terminal_get_screen_size ();
|
*old_signal_handler
|
||||||
terminal_prep_terminal ();
|
= (signal_handler *) signal (sig, info_signal_handler);
|
||||||
display_initialize_display (screenwidth, screenheight);
|
terminal_prep_terminal ();
|
||||||
window_new_screen_size (screenwidth, screenheight, (VFunction *)NULL);
|
reset_info_window_sizes ();
|
||||||
*old_signal_handler = (signal_handler *) signal (sig, info_signal_handler);
|
in_sigwinch--;
|
||||||
redisplay_after_signal ();
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* SIGWINCH */
|
#endif /* SIGWINCH || SIGUSR1 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user