1999-04-16 03:34:55 +02:00
|
|
|
/* signals.c -- signal handling support for readline. */
|
|
|
|
|
2015-07-25 21:41:05 +02:00
|
|
|
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
1999-04-16 03:34:55 +02:00
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
This file is part of the GNU Readline Library (Readline), a library
|
|
|
|
for reading lines of text with interactive input and history editing.
|
1999-04-16 03:34:55 +02:00
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
Readline is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
1999-04-16 03:34:55 +02:00
|
|
|
(at your option) any later version.
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
Readline is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
1999-04-16 03:34:55 +02:00
|
|
|
GNU General Public License for more details.
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Readline. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
#define READLINE_LIBRARY
|
|
|
|
|
|
|
|
#if defined (HAVE_CONFIG_H)
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h> /* Just for NULL. Yuck. */
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
#if defined (HAVE_UNISTD_H)
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif /* HAVE_UNISTD_H */
|
|
|
|
|
|
|
|
/* System-specific feature definitions and include files. */
|
|
|
|
#include "rldefs.h"
|
|
|
|
|
|
|
|
#if defined (GWINSZ_IN_SYS_IOCTL)
|
|
|
|
# include <sys/ioctl.h>
|
|
|
|
#endif /* GWINSZ_IN_SYS_IOCTL */
|
|
|
|
|
|
|
|
/* Some standard library routines. */
|
|
|
|
#include "readline.h"
|
|
|
|
#include "history.h"
|
|
|
|
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
#include "rlprivate.h"
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
#if defined (HANDLE_SIGNALS)
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
#if !defined (RETSIGTYPE)
|
|
|
|
# if defined (VOID_SIGHANDLER)
|
|
|
|
# define RETSIGTYPE void
|
|
|
|
# else
|
|
|
|
# define RETSIGTYPE int
|
|
|
|
# endif /* !VOID_SIGHANDLER */
|
|
|
|
#endif /* !RETSIGTYPE */
|
|
|
|
|
|
|
|
#if defined (VOID_SIGHANDLER)
|
|
|
|
# define SIGHANDLER_RETURN return
|
|
|
|
#else
|
|
|
|
# define SIGHANDLER_RETURN return (0)
|
|
|
|
#endif
|
|
|
|
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
/* This typedef is equivalent to the one for Function; it allows us
|
1999-04-16 03:34:55 +02:00
|
|
|
to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
|
|
|
|
typedef RETSIGTYPE SigHandler ();
|
|
|
|
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
|
|
|
typedef struct sigaction sighandler_cxt;
|
|
|
|
# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh)
|
|
|
|
#else
|
|
|
|
typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt;
|
|
|
|
# define sigemptyset(m)
|
|
|
|
#endif /* !HAVE_POSIX_SIGNALS */
|
1999-08-03 01:48:02 +02:00
|
|
|
|
2006-05-05 20:26:14 +02:00
|
|
|
#ifndef SA_RESTART
|
|
|
|
# define SA_RESTART 0
|
|
|
|
#endif
|
|
|
|
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *));
|
|
|
|
static void rl_maybe_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *));
|
1999-04-16 03:34:55 +02:00
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
static RETSIGTYPE rl_signal_handler PARAMS((int));
|
|
|
|
static RETSIGTYPE _rl_handle_signal PARAMS((int));
|
|
|
|
|
1999-08-03 01:48:02 +02:00
|
|
|
/* Exported variables for use by applications. */
|
|
|
|
|
|
|
|
/* If non-zero, readline will install its own signal handlers for
|
2015-07-25 21:41:05 +02:00
|
|
|
SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
|
1999-08-03 01:48:02 +02:00
|
|
|
int rl_catch_signals = 1;
|
|
|
|
|
|
|
|
/* If non-zero, readline will install a signal handler for SIGWINCH. */
|
|
|
|
#ifdef SIGWINCH
|
|
|
|
int rl_catch_sigwinch = 1;
|
2006-05-05 20:26:14 +02:00
|
|
|
#else
|
|
|
|
int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */
|
1999-08-03 01:48:02 +02:00
|
|
|
#endif
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
/* Private variables. */
|
|
|
|
int _rl_interrupt_immediately = 0;
|
|
|
|
int volatile _rl_caught_signal = 0; /* should be sig_atomic_t, but that requires including <signal.h> everywhere */
|
|
|
|
|
|
|
|
/* If non-zero, print characters corresponding to received signals as long as
|
|
|
|
the user has indicated his desire to do so (_rl_echo_control_chars). */
|
|
|
|
int _rl_echoctl = 0;
|
|
|
|
|
|
|
|
int _rl_intr_char = 0;
|
|
|
|
int _rl_quit_char = 0;
|
|
|
|
int _rl_susp_char = 0;
|
|
|
|
|
1999-08-03 01:48:02 +02:00
|
|
|
static int signals_set_flag;
|
|
|
|
static int sigwinch_set_flag;
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
/* **************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* Signal Handling */
|
|
|
|
/* */
|
|
|
|
/* **************************************************************** */
|
|
|
|
|
2015-07-25 21:41:05 +02:00
|
|
|
static sighandler_cxt old_int, old_term, old_alrm, old_quit;
|
1999-08-03 01:48:02 +02:00
|
|
|
#if defined (SIGTSTP)
|
1999-04-16 03:34:55 +02:00
|
|
|
static sighandler_cxt old_tstp, old_ttou, old_ttin;
|
|
|
|
#endif
|
|
|
|
#if defined (SIGWINCH)
|
|
|
|
static sighandler_cxt old_winch;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Readline signal handler functions. */
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
/* Called from RL_CHECK_SIGNALS() macro */
|
|
|
|
RETSIGTYPE
|
|
|
|
_rl_signal_handler (sig)
|
|
|
|
int sig;
|
|
|
|
{
|
|
|
|
_rl_caught_signal = 0; /* XXX */
|
|
|
|
|
2015-07-25 21:41:05 +02:00
|
|
|
_rl_handle_signal (sig);
|
2011-05-12 01:38:44 +02:00
|
|
|
SIGHANDLER_RETURN;
|
|
|
|
}
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
static RETSIGTYPE
|
|
|
|
rl_signal_handler (sig)
|
|
|
|
int sig;
|
2011-05-12 01:38:44 +02:00
|
|
|
{
|
2015-07-25 21:41:05 +02:00
|
|
|
if (_rl_interrupt_immediately || RL_ISSTATE(RL_STATE_CALLBACK))
|
2011-05-12 01:38:44 +02:00
|
|
|
{
|
|
|
|
_rl_interrupt_immediately = 0;
|
|
|
|
_rl_handle_signal (sig);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_rl_caught_signal = sig;
|
|
|
|
|
|
|
|
SIGHANDLER_RETURN;
|
|
|
|
}
|
|
|
|
|
|
|
|
static RETSIGTYPE
|
|
|
|
_rl_handle_signal (sig)
|
|
|
|
int sig;
|
1999-04-16 03:34:55 +02:00
|
|
|
{
|
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
|
|
|
sigset_t set;
|
|
|
|
#else /* !HAVE_POSIX_SIGNALS */
|
|
|
|
# if defined (HAVE_BSD_SIGNALS)
|
|
|
|
long omask;
|
|
|
|
# else /* !HAVE_BSD_SIGNALS */
|
|
|
|
sighandler_cxt dummy_cxt; /* needed for rl_set_sighandler call */
|
|
|
|
# endif /* !HAVE_BSD_SIGNALS */
|
|
|
|
#endif /* !HAVE_POSIX_SIGNALS */
|
|
|
|
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
RL_SETSTATE(RL_STATE_SIGHANDLER);
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
|
|
|
|
/* Since the signal will not be blocked while we are in the signal
|
|
|
|
handler, ignore it until rl_clear_signals resets the catcher. */
|
2006-05-05 20:26:14 +02:00
|
|
|
# if defined (SIGALRM)
|
|
|
|
if (sig == SIGINT || sig == SIGALRM)
|
|
|
|
# else
|
|
|
|
if (sig == SIGINT)
|
|
|
|
# endif
|
1999-04-16 03:34:55 +02:00
|
|
|
rl_set_sighandler (sig, SIG_IGN, &dummy_cxt);
|
|
|
|
#endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
|
|
|
|
|
|
|
|
switch (sig)
|
|
|
|
{
|
|
|
|
case SIGINT:
|
2011-05-12 01:38:44 +02:00
|
|
|
_rl_reset_completion_state ();
|
1999-08-03 01:48:02 +02:00
|
|
|
rl_free_line_state ();
|
|
|
|
/* FALLTHROUGH */
|
1999-04-16 03:34:55 +02:00
|
|
|
|
2015-07-25 21:41:05 +02:00
|
|
|
case SIGTERM:
|
1999-04-16 03:34:55 +02:00
|
|
|
#if defined (SIGTSTP)
|
|
|
|
case SIGTSTP:
|
Sync readline/ to version 7.0 alpha
This patch syncs our upstream copy of readline from version 6.2 to the
latest version, 7.0 alpha (released July 10 2015).
I essentially copied what was done the last time readline was synced,
when Jan updated to readline 6.2 in 2011:
http://sourceware.org/ml/gdb-patches/2011-05/msg00003.html
Procedure:
1. I extracted the readline-7.0-alpha tarball on top of readline/.
2. I deleted all the new files under doc/ that were deliberately omitted
before.
3. I regenerated readline/configure and readline/examples/rlfe/configure
using autoconf 2.64. No other configure files need regenerating.
4. I updated the function gdb_printable_part in completer.c with a
trivial change made to the readline function it is based off of,
printable_part in readline/complete.c. There is more work to be done in
completer.c to sync it with readline/complete.c, but it is non-trivial
and should probably be done separately anyway.
Local patches that had to be reapplied:
None. readline 7.0 alpha contains all of our local readline
patches.
New files in readline/:
colors.{c,h}
examples/{hist_erasedups,hist_purgecmd,rl-callbacktest,rlbasic}.c
parse-colors.{c,h}
readline.pc.in
configure.ac
Deleted files in readline/:
configure.in
Regressions:
After the sync there is one testsuite regression, the test
"signal SIGINT" in gdb.gdb/selftest.exp which now FAILs. Previously,
the readline 6.2 SIGINT handler would temporarily reinstall the
underlying application's SIGINT handler and immediately re-raise SIGINT
so that the orginal handler gets invoked. But now (since readline 6.3)
its SIGINT handler does not re-raise SIGINT or directly invoke the
original handler; it now sets a flag marking that SIGINT was raised, and
waits until readline explicitly has control to call the application's
SIGINT handler. Anyway, because SIGINT is no longer re-raised from
within readline's SIGINT handler, doing "signal SIGINT" with a stopped
inferior gdb process will no longer resume and then immediately stop the
process (since there is no 2nd SIGINT to immediately catch). Instead,
the inferior gdb process will now just print "Quit" and continue to run.
So with this commit, this particular test case is adjusted to reflect
this change in behavior (we now have to send a 2nd SIGINT manually to
stop it).
Aside from this one testsuite regression, I personally noticed no
regression in user-visible behavior. Though I only tested on x86_64
and on i686 Debian Stretch.
Getting this kind of change in at the start of the GDB 7.11 development
cycle will allow us to get a lot of passive testing from developers and
from bleeding-edge users.
readline/ChangeLog.gdb:
Import readline 7.0 alpha
* configure: Regenerate.
* examples/rlfe/configure: Regenerate.
gdb/ChangeLog:
* completer.c (gdb_printable_part): Sync with readline function
it is based off of.
gdb/testsuite/ChangeLog:
* gdb.gdb/selftest.exp (test_with_self): Update test to now
expect the GDB inferior to no longer immediately stop after
being resumed with "signal SIGINT".
2015-07-15 02:29:21 +02:00
|
|
|
case SIGTTOU:
|
2015-07-25 21:41:05 +02:00
|
|
|
case SIGTTIN:
|
1999-04-16 03:34:55 +02:00
|
|
|
#endif /* SIGTSTP */
|
2006-05-05 20:26:14 +02:00
|
|
|
#if defined (SIGALRM)
|
1999-04-16 03:34:55 +02:00
|
|
|
case SIGALRM:
|
2005-05-09 21:42:03 +02:00
|
|
|
#endif
|
2006-05-05 20:26:14 +02:00
|
|
|
#if defined (SIGQUIT)
|
1999-08-03 01:48:02 +02:00
|
|
|
case SIGQUIT:
|
2005-05-09 21:42:03 +02:00
|
|
|
#endif
|
2011-05-12 01:38:44 +02:00
|
|
|
rl_echo_signal_char (sig);
|
1999-08-03 01:48:02 +02:00
|
|
|
rl_cleanup_after_signal ();
|
1999-04-16 03:34:55 +02:00
|
|
|
|
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
2011-05-12 01:38:44 +02:00
|
|
|
sigemptyset (&set);
|
1999-04-16 03:34:55 +02:00
|
|
|
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
|
|
|
|
sigdelset (&set, sig);
|
|
|
|
#else /* !HAVE_POSIX_SIGNALS */
|
|
|
|
# if defined (HAVE_BSD_SIGNALS)
|
|
|
|
omask = sigblock (0);
|
|
|
|
# endif /* HAVE_BSD_SIGNALS */
|
|
|
|
#endif /* !HAVE_POSIX_SIGNALS */
|
|
|
|
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
#if defined (__EMX__)
|
|
|
|
signal (sig, SIG_ACK);
|
|
|
|
#endif
|
|
|
|
|
2006-05-05 20:26:14 +02:00
|
|
|
#if defined (HAVE_KILL)
|
1999-04-16 03:34:55 +02:00
|
|
|
kill (getpid (), sig);
|
2005-05-09 21:42:03 +02:00
|
|
|
#else
|
2006-05-05 20:26:14 +02:00
|
|
|
raise (sig); /* assume we have raise */
|
2005-05-09 21:42:03 +02:00
|
|
|
#endif
|
1999-04-16 03:34:55 +02:00
|
|
|
|
|
|
|
/* Let the signal that we just sent through. */
|
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
|
|
|
sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL);
|
|
|
|
#else /* !HAVE_POSIX_SIGNALS */
|
|
|
|
# if defined (HAVE_BSD_SIGNALS)
|
|
|
|
sigsetmask (omask & ~(sigmask (sig)));
|
|
|
|
# endif /* HAVE_BSD_SIGNALS */
|
|
|
|
#endif /* !HAVE_POSIX_SIGNALS */
|
|
|
|
|
2015-07-25 21:41:05 +02:00
|
|
|
rl_reset_after_signal ();
|
1999-04-16 03:34:55 +02:00
|
|
|
}
|
|
|
|
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
|
1999-04-16 03:34:55 +02:00
|
|
|
SIGHANDLER_RETURN;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined (SIGWINCH)
|
|
|
|
static RETSIGTYPE
|
1999-08-03 01:48:02 +02:00
|
|
|
rl_sigwinch_handler (sig)
|
1999-04-16 03:34:55 +02:00
|
|
|
int sig;
|
|
|
|
{
|
|
|
|
SigHandler *oh;
|
|
|
|
|
|
|
|
#if defined (MUST_REINSTALL_SIGHANDLERS)
|
|
|
|
sighandler_cxt dummy_winch;
|
|
|
|
|
|
|
|
/* We don't want to change old_winch -- it holds the state of SIGWINCH
|
|
|
|
disposition set by the calling application. We need this state
|
|
|
|
because we call the application's SIGWINCH handler after updating
|
|
|
|
our own idea of the screen size. */
|
1999-08-03 01:48:02 +02:00
|
|
|
rl_set_sighandler (SIGWINCH, rl_sigwinch_handler, &dummy_winch);
|
1999-04-16 03:34:55 +02:00
|
|
|
#endif
|
|
|
|
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
RL_SETSTATE(RL_STATE_SIGHANDLER);
|
2015-07-25 21:41:05 +02:00
|
|
|
rl_resize_terminal ();
|
1999-04-16 03:34:55 +02:00
|
|
|
|
|
|
|
/* If another sigwinch handler has been installed, call it. */
|
|
|
|
oh = (SigHandler *)old_winch.sa_handler;
|
|
|
|
if (oh && oh != (SigHandler *)SIG_IGN && oh != (SigHandler *)SIG_DFL)
|
|
|
|
(*oh) (sig);
|
|
|
|
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
|
1999-04-16 03:34:55 +02:00
|
|
|
SIGHANDLER_RETURN;
|
|
|
|
}
|
|
|
|
#endif /* SIGWINCH */
|
|
|
|
|
|
|
|
/* Functions to manage signal handling. */
|
|
|
|
|
|
|
|
#if !defined (HAVE_POSIX_SIGNALS)
|
|
|
|
static int
|
|
|
|
rl_sigaction (sig, nh, oh)
|
|
|
|
int sig;
|
|
|
|
sighandler_cxt *nh, *oh;
|
|
|
|
{
|
|
|
|
oh->sa_handler = signal (sig, nh->sa_handler);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* !HAVE_POSIX_SIGNALS */
|
|
|
|
|
|
|
|
/* Set up a readline-specific signal handler, saving the old signal
|
|
|
|
information in OHANDLER. Return the old signal handler, like
|
|
|
|
signal(). */
|
|
|
|
static SigHandler *
|
|
|
|
rl_set_sighandler (sig, handler, ohandler)
|
|
|
|
int sig;
|
|
|
|
SigHandler *handler;
|
|
|
|
sighandler_cxt *ohandler;
|
|
|
|
{
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
sighandler_cxt old_handler;
|
1999-04-16 03:34:55 +02:00
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
|
|
|
struct sigaction act;
|
|
|
|
|
|
|
|
act.sa_handler = handler;
|
2011-05-12 01:38:44 +02:00
|
|
|
# if defined (SIGWINCH)
|
2006-05-05 20:26:14 +02:00
|
|
|
act.sa_flags = (sig == SIGWINCH) ? SA_RESTART : 0;
|
2011-05-12 01:38:44 +02:00
|
|
|
# else
|
2008-08-10 21:17:42 +02:00
|
|
|
act.sa_flags = 0;
|
2011-05-12 01:38:44 +02:00
|
|
|
# endif /* SIGWINCH */
|
1999-04-16 03:34:55 +02:00
|
|
|
sigemptyset (&act.sa_mask);
|
|
|
|
sigemptyset (&ohandler->sa_mask);
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
sigaction (sig, &act, &old_handler);
|
1999-04-16 03:34:55 +02:00
|
|
|
#else
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
old_handler.sa_handler = (SigHandler *)signal (sig, handler);
|
1999-04-16 03:34:55 +02:00
|
|
|
#endif /* !HAVE_POSIX_SIGNALS */
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
|
|
|
|
/* XXX -- assume we have memcpy */
|
|
|
|
/* If rl_set_signals is called twice in a row, don't set the old handler to
|
|
|
|
rl_signal_handler, because that would cause infinite recursion. */
|
|
|
|
if (handler != rl_signal_handler || old_handler.sa_handler != rl_signal_handler)
|
|
|
|
memcpy (ohandler, &old_handler, sizeof (sighandler_cxt));
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
return (ohandler->sa_handler);
|
|
|
|
}
|
|
|
|
|
1999-08-03 01:48:02 +02:00
|
|
|
static void
|
|
|
|
rl_maybe_set_sighandler (sig, handler, ohandler)
|
|
|
|
int sig;
|
|
|
|
SigHandler *handler;
|
|
|
|
sighandler_cxt *ohandler;
|
1999-04-16 03:34:55 +02:00
|
|
|
{
|
|
|
|
sighandler_cxt dummy;
|
|
|
|
SigHandler *oh;
|
|
|
|
|
|
|
|
sigemptyset (&dummy.sa_mask);
|
1999-08-03 01:48:02 +02:00
|
|
|
oh = rl_set_sighandler (sig, handler, ohandler);
|
1999-04-16 03:34:55 +02:00
|
|
|
if (oh == (SigHandler *)SIG_IGN)
|
1999-08-03 01:48:02 +02:00
|
|
|
rl_sigaction (sig, ohandler, &dummy);
|
|
|
|
}
|
1999-04-16 03:34:55 +02:00
|
|
|
|
1999-08-03 01:48:02 +02:00
|
|
|
int
|
|
|
|
rl_set_signals ()
|
|
|
|
{
|
|
|
|
sighandler_cxt dummy;
|
|
|
|
SigHandler *oh;
|
2011-05-12 01:38:44 +02:00
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
|
|
|
static int sigmask_set = 0;
|
|
|
|
static sigset_t bset, oset;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
|
|
|
if (rl_catch_signals && sigmask_set == 0)
|
|
|
|
{
|
|
|
|
sigemptyset (&bset);
|
|
|
|
|
|
|
|
sigaddset (&bset, SIGINT);
|
|
|
|
sigaddset (&bset, SIGTERM);
|
|
|
|
#if defined (SIGQUIT)
|
|
|
|
sigaddset (&bset, SIGQUIT);
|
|
|
|
#endif
|
|
|
|
#if defined (SIGALRM)
|
|
|
|
sigaddset (&bset, SIGALRM);
|
|
|
|
#endif
|
|
|
|
#if defined (SIGTSTP)
|
|
|
|
sigaddset (&bset, SIGTSTP);
|
|
|
|
#endif
|
|
|
|
#if defined (SIGTTIN)
|
|
|
|
sigaddset (&bset, SIGTTIN);
|
|
|
|
#endif
|
|
|
|
#if defined (SIGTTOU)
|
|
|
|
sigaddset (&bset, SIGTTOU);
|
|
|
|
#endif
|
|
|
|
sigmask_set = 1;
|
|
|
|
}
|
|
|
|
#endif /* HAVE_POSIX_SIGNALS */
|
1999-08-03 01:48:02 +02:00
|
|
|
|
|
|
|
if (rl_catch_signals && signals_set_flag == 0)
|
|
|
|
{
|
2011-05-12 01:38:44 +02:00
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
|
|
|
sigemptyset (&oset);
|
|
|
|
sigprocmask (SIG_BLOCK, &bset, &oset);
|
|
|
|
#endif
|
|
|
|
|
1999-08-03 01:48:02 +02:00
|
|
|
rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
|
|
|
|
rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
|
2006-05-05 20:26:14 +02:00
|
|
|
#if defined (SIGQUIT)
|
1999-08-03 01:48:02 +02:00
|
|
|
rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit);
|
2005-05-09 21:42:03 +02:00
|
|
|
#endif
|
1999-08-03 01:48:02 +02:00
|
|
|
|
2006-05-05 20:26:14 +02:00
|
|
|
#if defined (SIGALRM)
|
1999-08-03 01:48:02 +02:00
|
|
|
oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm);
|
|
|
|
if (oh == (SigHandler *)SIG_IGN)
|
|
|
|
rl_sigaction (SIGALRM, &old_alrm, &dummy);
|
1999-04-16 03:34:55 +02:00
|
|
|
#if defined (HAVE_POSIX_SIGNALS) && defined (SA_RESTART)
|
1999-08-03 01:48:02 +02:00
|
|
|
/* If the application using readline has already installed a signal
|
|
|
|
handler with SA_RESTART, SIGALRM will cause reads to be restarted
|
|
|
|
automatically, so readline should just get out of the way. Since
|
|
|
|
we tested for SIG_IGN above, we can just test for SIG_DFL here. */
|
|
|
|
if (oh != (SigHandler *)SIG_DFL && (old_alrm.sa_flags & SA_RESTART))
|
|
|
|
rl_sigaction (SIGALRM, &old_alrm, &dummy);
|
1999-04-16 03:34:55 +02:00
|
|
|
#endif /* HAVE_POSIX_SIGNALS */
|
2005-05-09 21:42:03 +02:00
|
|
|
#endif /* SIGALRM */
|
1999-04-16 03:34:55 +02:00
|
|
|
|
|
|
|
#if defined (SIGTSTP)
|
1999-08-03 01:48:02 +02:00
|
|
|
rl_maybe_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp);
|
1999-04-16 03:34:55 +02:00
|
|
|
#endif /* SIGTSTP */
|
|
|
|
|
|
|
|
#if defined (SIGTTOU)
|
1999-08-03 01:48:02 +02:00
|
|
|
rl_maybe_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou);
|
1999-04-16 03:34:55 +02:00
|
|
|
#endif /* SIGTTOU */
|
|
|
|
|
1999-08-03 01:48:02 +02:00
|
|
|
#if defined (SIGTTIN)
|
|
|
|
rl_maybe_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin);
|
|
|
|
#endif /* SIGTTIN */
|
1999-04-16 03:34:55 +02:00
|
|
|
|
1999-08-03 01:48:02 +02:00
|
|
|
signals_set_flag = 1;
|
2011-05-12 01:38:44 +02:00
|
|
|
|
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
|
|
|
sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
|
|
|
|
#endif
|
1999-08-03 01:48:02 +02:00
|
|
|
}
|
1999-04-16 03:34:55 +02:00
|
|
|
|
|
|
|
#if defined (SIGWINCH)
|
1999-08-03 01:48:02 +02:00
|
|
|
if (rl_catch_sigwinch && sigwinch_set_flag == 0)
|
|
|
|
{
|
|
|
|
rl_maybe_set_sighandler (SIGWINCH, rl_sigwinch_handler, &old_winch);
|
|
|
|
sigwinch_set_flag = 1;
|
|
|
|
}
|
1999-04-16 03:34:55 +02:00
|
|
|
#endif /* SIGWINCH */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
rl_clear_signals ()
|
|
|
|
{
|
|
|
|
sighandler_cxt dummy;
|
|
|
|
|
1999-08-03 01:48:02 +02:00
|
|
|
if (rl_catch_signals && signals_set_flag == 1)
|
|
|
|
{
|
|
|
|
sigemptyset (&dummy.sa_mask);
|
1999-04-16 03:34:55 +02:00
|
|
|
|
2015-07-25 21:41:05 +02:00
|
|
|
rl_sigaction (SIGINT, &old_int, &dummy);
|
|
|
|
rl_sigaction (SIGTERM, &old_term, &dummy);
|
2006-05-05 20:26:14 +02:00
|
|
|
#if defined (SIGQUIT)
|
2015-07-25 21:41:05 +02:00
|
|
|
rl_sigaction (SIGQUIT, &old_quit, &dummy);
|
2005-05-09 21:42:03 +02:00
|
|
|
#endif
|
2006-05-05 20:26:14 +02:00
|
|
|
#if defined (SIGALRM)
|
2015-07-25 21:41:05 +02:00
|
|
|
rl_sigaction (SIGALRM, &old_alrm, &dummy);
|
2005-05-09 21:42:03 +02:00
|
|
|
#endif
|
1999-04-16 03:34:55 +02:00
|
|
|
|
|
|
|
#if defined (SIGTSTP)
|
2015-07-25 21:41:05 +02:00
|
|
|
rl_sigaction (SIGTSTP, &old_tstp, &dummy);
|
1999-08-03 01:48:02 +02:00
|
|
|
#endif /* SIGTSTP */
|
1999-04-16 03:34:55 +02:00
|
|
|
|
|
|
|
#if defined (SIGTTOU)
|
2015-07-25 21:41:05 +02:00
|
|
|
rl_sigaction (SIGTTOU, &old_ttou, &dummy);
|
1999-04-16 03:34:55 +02:00
|
|
|
#endif /* SIGTTOU */
|
|
|
|
|
1999-08-03 01:48:02 +02:00
|
|
|
#if defined (SIGTTIN)
|
2015-07-25 21:41:05 +02:00
|
|
|
rl_sigaction (SIGTTIN, &old_ttin, &dummy);
|
1999-08-03 01:48:02 +02:00
|
|
|
#endif /* SIGTTIN */
|
1999-04-16 03:34:55 +02:00
|
|
|
|
1999-08-03 01:48:02 +02:00
|
|
|
signals_set_flag = 0;
|
|
|
|
}
|
1999-04-16 03:34:55 +02:00
|
|
|
|
|
|
|
#if defined (SIGWINCH)
|
1999-08-03 01:48:02 +02:00
|
|
|
if (rl_catch_sigwinch && sigwinch_set_flag == 1)
|
|
|
|
{
|
|
|
|
sigemptyset (&dummy.sa_mask);
|
|
|
|
rl_sigaction (SIGWINCH, &old_winch, &dummy);
|
|
|
|
sigwinch_set_flag = 0;
|
|
|
|
}
|
1999-04-16 03:34:55 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
1999-08-03 01:48:02 +02:00
|
|
|
|
|
|
|
/* Clean up the terminal and readline state after catching a signal, before
|
|
|
|
resending it to the calling application. */
|
|
|
|
void
|
|
|
|
rl_cleanup_after_signal ()
|
|
|
|
{
|
|
|
|
_rl_clean_up_for_exit ();
|
2006-05-05 20:26:14 +02:00
|
|
|
if (rl_deprep_term_function)
|
|
|
|
(*rl_deprep_term_function) ();
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
rl_clear_pending_input ();
|
2011-05-12 01:38:44 +02:00
|
|
|
rl_clear_signals ();
|
1999-08-03 01:48:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Reset the terminal and readline state after a signal handler returns. */
|
|
|
|
void
|
|
|
|
rl_reset_after_signal ()
|
|
|
|
{
|
2006-05-05 20:26:14 +02:00
|
|
|
if (rl_prep_term_function)
|
|
|
|
(*rl_prep_term_function) (_rl_meta_flag);
|
1999-08-03 01:48:02 +02:00
|
|
|
rl_set_signals ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free up the readline variable line state for the current line (undo list,
|
|
|
|
any partial history entry, any keyboard macros in progress, and any
|
|
|
|
numeric arguments in process) after catching a signal, before calling
|
|
|
|
rl_cleanup_after_signal(). */
|
|
|
|
void
|
|
|
|
rl_free_line_state ()
|
|
|
|
{
|
|
|
|
register HIST_ENTRY *entry;
|
|
|
|
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
rl_free_undo_list ();
|
1999-08-03 01:48:02 +02:00
|
|
|
|
|
|
|
entry = current_history ();
|
|
|
|
if (entry)
|
|
|
|
entry->data = (char *)NULL;
|
|
|
|
|
|
|
|
_rl_kill_kbd_macro ();
|
|
|
|
rl_clear_message ();
|
2006-05-05 20:26:14 +02:00
|
|
|
_rl_reset_argument ();
|
1999-08-03 01:48:02 +02:00
|
|
|
}
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
#endif /* HANDLE_SIGNALS */
|
2011-05-12 01:38:44 +02:00
|
|
|
|
|
|
|
/* **************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* SIGINT Management */
|
|
|
|
/* */
|
|
|
|
/* **************************************************************** */
|
|
|
|
|
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
|
|
|
static sigset_t sigint_set, sigint_oset;
|
|
|
|
static sigset_t sigwinch_set, sigwinch_oset;
|
|
|
|
#else /* !HAVE_POSIX_SIGNALS */
|
|
|
|
# if defined (HAVE_BSD_SIGNALS)
|
|
|
|
static int sigint_oldmask;
|
|
|
|
static int sigwinch_oldmask;
|
|
|
|
# endif /* HAVE_BSD_SIGNALS */
|
|
|
|
#endif /* !HAVE_POSIX_SIGNALS */
|
|
|
|
|
|
|
|
static int sigint_blocked;
|
|
|
|
static int sigwinch_blocked;
|
|
|
|
|
|
|
|
/* Cause SIGINT to not be delivered until the corresponding call to
|
|
|
|
release_sigint(). */
|
|
|
|
void
|
|
|
|
_rl_block_sigint ()
|
|
|
|
{
|
|
|
|
if (sigint_blocked)
|
|
|
|
return;
|
|
|
|
|
2015-07-25 21:41:05 +02:00
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
|
|
|
sigemptyset (&sigint_set);
|
|
|
|
sigemptyset (&sigint_oset);
|
|
|
|
sigaddset (&sigint_set, SIGINT);
|
|
|
|
sigprocmask (SIG_BLOCK, &sigint_set, &sigint_oset);
|
|
|
|
#else /* !HAVE_POSIX_SIGNALS */
|
|
|
|
# if defined (HAVE_BSD_SIGNALS)
|
|
|
|
sigint_oldmask = sigblock (sigmask (SIGINT));
|
|
|
|
# else /* !HAVE_BSD_SIGNALS */
|
|
|
|
# if defined (HAVE_USG_SIGHOLD)
|
|
|
|
sighold (SIGINT);
|
|
|
|
# endif /* HAVE_USG_SIGHOLD */
|
|
|
|
# endif /* !HAVE_BSD_SIGNALS */
|
|
|
|
#endif /* !HAVE_POSIX_SIGNALS */
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
sigint_blocked = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allow SIGINT to be delivered. */
|
|
|
|
void
|
|
|
|
_rl_release_sigint ()
|
|
|
|
{
|
|
|
|
if (sigint_blocked == 0)
|
|
|
|
return;
|
|
|
|
|
2015-07-25 21:41:05 +02:00
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
|
|
|
sigprocmask (SIG_SETMASK, &sigint_oset, (sigset_t *)NULL);
|
|
|
|
#else
|
|
|
|
# if defined (HAVE_BSD_SIGNALS)
|
|
|
|
sigsetmask (sigint_oldmask);
|
|
|
|
# else /* !HAVE_BSD_SIGNALS */
|
|
|
|
# if defined (HAVE_USG_SIGHOLD)
|
|
|
|
sigrelse (SIGINT);
|
|
|
|
# endif /* HAVE_USG_SIGHOLD */
|
|
|
|
# endif /* !HAVE_BSD_SIGNALS */
|
|
|
|
#endif /* !HAVE_POSIX_SIGNALS */
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
sigint_blocked = 0;
|
|
|
|
}
|
|
|
|
|
2015-07-25 21:41:05 +02:00
|
|
|
#ifdef SIGWINCH
|
2011-05-12 01:38:44 +02:00
|
|
|
/* Cause SIGWINCH to not be delivered until the corresponding call to
|
|
|
|
release_sigwinch(). */
|
|
|
|
void
|
|
|
|
_rl_block_sigwinch ()
|
|
|
|
{
|
|
|
|
if (sigwinch_blocked)
|
|
|
|
return;
|
|
|
|
|
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
|
|
|
sigemptyset (&sigwinch_set);
|
|
|
|
sigemptyset (&sigwinch_oset);
|
|
|
|
sigaddset (&sigwinch_set, SIGWINCH);
|
|
|
|
sigprocmask (SIG_BLOCK, &sigwinch_set, &sigwinch_oset);
|
|
|
|
#else /* !HAVE_POSIX_SIGNALS */
|
|
|
|
# if defined (HAVE_BSD_SIGNALS)
|
|
|
|
sigwinch_oldmask = sigblock (sigmask (SIGWINCH));
|
|
|
|
# else /* !HAVE_BSD_SIGNALS */
|
|
|
|
# if defined (HAVE_USG_SIGHOLD)
|
|
|
|
sighold (SIGWINCH);
|
|
|
|
# endif /* HAVE_USG_SIGHOLD */
|
|
|
|
# endif /* !HAVE_BSD_SIGNALS */
|
|
|
|
#endif /* !HAVE_POSIX_SIGNALS */
|
|
|
|
|
|
|
|
sigwinch_blocked = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allow SIGWINCH to be delivered. */
|
|
|
|
void
|
|
|
|
_rl_release_sigwinch ()
|
|
|
|
{
|
|
|
|
if (sigwinch_blocked == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
#if defined (HAVE_POSIX_SIGNALS)
|
|
|
|
sigprocmask (SIG_SETMASK, &sigwinch_oset, (sigset_t *)NULL);
|
|
|
|
#else
|
|
|
|
# if defined (HAVE_BSD_SIGNALS)
|
|
|
|
sigsetmask (sigwinch_oldmask);
|
|
|
|
# else /* !HAVE_BSD_SIGNALS */
|
|
|
|
# if defined (HAVE_USG_SIGHOLD)
|
|
|
|
sigrelse (SIGWINCH);
|
|
|
|
# endif /* HAVE_USG_SIGHOLD */
|
|
|
|
# endif /* !HAVE_BSD_SIGNALS */
|
|
|
|
#endif /* !HAVE_POSIX_SIGNALS */
|
|
|
|
|
|
|
|
sigwinch_blocked = 0;
|
|
|
|
}
|
2015-07-25 21:41:05 +02:00
|
|
|
#endif /* SIGWINCH */
|
2011-05-12 01:38:44 +02:00
|
|
|
|
|
|
|
/* **************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* Echoing special control characters */
|
|
|
|
/* */
|
|
|
|
/* **************************************************************** */
|
|
|
|
void
|
|
|
|
rl_echo_signal_char (sig)
|
|
|
|
int sig;
|
|
|
|
{
|
|
|
|
char cstr[3];
|
|
|
|
int cslen, c;
|
|
|
|
|
|
|
|
if (_rl_echoctl == 0 || _rl_echo_control_chars == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (sig)
|
|
|
|
{
|
|
|
|
case SIGINT: c = _rl_intr_char; break;
|
|
|
|
#if defined (SIGQUIT)
|
|
|
|
case SIGQUIT: c = _rl_quit_char; break;
|
|
|
|
#endif
|
|
|
|
#if defined (SIGTSTP)
|
|
|
|
case SIGTSTP: c = _rl_susp_char; break;
|
|
|
|
#endif
|
|
|
|
default: return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CTRL_CHAR (c) || c == RUBOUT)
|
|
|
|
{
|
|
|
|
cstr[0] = '^';
|
|
|
|
cstr[1] = CTRL_CHAR (c) ? UNCTRL (c) : '?';
|
|
|
|
cstr[cslen = 2] = '\0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cstr[0] = c;
|
|
|
|
cstr[cslen = 1] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
_rl_output_some_chars (cstr, cslen);
|
|
|
|
}
|