Deleted Added
full compact
signals.c (157184) signals.c (165670)
1/* signals.c -- signal handling support for readline. */
2
3/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
4
5 This file is part of the GNU Readline Library, a library for
6 reading lines of text with interactive input and history editing.
7
8 The GNU Readline Library is free software; you can redistribute it

--- 146 unchanged lines hidden (view full) ---

155 case SIGALRM:
156#endif
157#if defined (SIGQUIT)
158 case SIGQUIT:
159#endif
160 rl_cleanup_after_signal ();
161
162#if defined (HAVE_POSIX_SIGNALS)
1/* signals.c -- signal handling support for readline. */
2
3/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
4
5 This file is part of the GNU Readline Library, a library for
6 reading lines of text with interactive input and history editing.
7
8 The GNU Readline Library is free software; you can redistribute it

--- 146 unchanged lines hidden (view full) ---

155 case SIGALRM:
156#endif
157#if defined (SIGQUIT)
158 case SIGQUIT:
159#endif
160 rl_cleanup_after_signal ();
161
162#if defined (HAVE_POSIX_SIGNALS)
163 sigemptyset (&set);
163 sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
164 sigdelset (&set, sig);
165#else /* !HAVE_POSIX_SIGNALS */
166# if defined (HAVE_BSD_SIGNALS)
167 omask = sigblock (0);
168# endif /* HAVE_BSD_SIGNALS */
169#endif /* !HAVE_POSIX_SIGNALS */
170

--- 112 unchanged lines hidden (view full) ---

283 rl_sigaction (sig, ohandler, &dummy);
284}
285
286int
287rl_set_signals ()
288{
289 sighandler_cxt dummy;
290 SigHandler *oh;
164 sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
165 sigdelset (&set, sig);
166#else /* !HAVE_POSIX_SIGNALS */
167# if defined (HAVE_BSD_SIGNALS)
168 omask = sigblock (0);
169# endif /* HAVE_BSD_SIGNALS */
170#endif /* !HAVE_POSIX_SIGNALS */
171

--- 112 unchanged lines hidden (view full) ---

284 rl_sigaction (sig, ohandler, &dummy);
285}
286
287int
288rl_set_signals ()
289{
290 sighandler_cxt dummy;
291 SigHandler *oh;
292#if defined (HAVE_POSIX_SIGNALS)
293 static int sigmask_set = 0;
294 static sigset_t bset, oset;
295#endif
291
296
297#if defined (HAVE_POSIX_SIGNALS)
298 if (rl_catch_signals && sigmask_set == 0)
299 {
300 sigemptyset (&bset);
301
302 sigaddset (&bset, SIGINT);
303 sigaddset (&bset, SIGINT);
304#if defined (SIGQUIT)
305 sigaddset (&bset, SIGQUIT);
306#endif
307#if defined (SIGALRM)
308 sigaddset (&bset, SIGALRM);
309#endif
310#if defined (SIGTSTP)
311 sigaddset (&bset, SIGTSTP);
312#endif
313#if defined (SIGTTIN)
314 sigaddset (&bset, SIGTTIN);
315#endif
316#if defined (SIGTTOU)
317 sigaddset (&bset, SIGTTOU);
318#endif
319 sigmask_set = 1;
320 }
321#endif /* HAVE_POSIX_SIGNALS */
322
292 if (rl_catch_signals && signals_set_flag == 0)
293 {
323 if (rl_catch_signals && signals_set_flag == 0)
324 {
325#if defined (HAVE_POSIX_SIGNALS)
326 sigemptyset (&oset);
327 sigprocmask (SIG_BLOCK, &bset, &oset);
328#endif
329
294 rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
295 rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
296#if defined (SIGQUIT)
297 rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit);
298#endif
299
300#if defined (SIGALRM)
301 oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm);

--- 17 unchanged lines hidden (view full) ---

319 rl_maybe_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou);
320#endif /* SIGTTOU */
321
322#if defined (SIGTTIN)
323 rl_maybe_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin);
324#endif /* SIGTTIN */
325
326 signals_set_flag = 1;
330 rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
331 rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
332#if defined (SIGQUIT)
333 rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit);
334#endif
335
336#if defined (SIGALRM)
337 oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm);

--- 17 unchanged lines hidden (view full) ---

355 rl_maybe_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou);
356#endif /* SIGTTOU */
357
358#if defined (SIGTTIN)
359 rl_maybe_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin);
360#endif /* SIGTTIN */
361
362 signals_set_flag = 1;
363
364#if defined (HAVE_POSIX_SIGNALS)
365 sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
366#endif
327 }
328
329#if defined (SIGWINCH)
330 if (rl_catch_sigwinch && sigwinch_set_flag == 0)
331 {
332 rl_maybe_set_sighandler (SIGWINCH, rl_sigwinch_handler, &old_winch);
333 sigwinch_set_flag = 1;
334 }

--- 50 unchanged lines hidden (view full) ---

385/* Clean up the terminal and readline state after catching a signal, before
386 resending it to the calling application. */
387void
388rl_cleanup_after_signal ()
389{
390 _rl_clean_up_for_exit ();
391 if (rl_deprep_term_function)
392 (*rl_deprep_term_function) ();
367 }
368
369#if defined (SIGWINCH)
370 if (rl_catch_sigwinch && sigwinch_set_flag == 0)
371 {
372 rl_maybe_set_sighandler (SIGWINCH, rl_sigwinch_handler, &old_winch);
373 sigwinch_set_flag = 1;
374 }

--- 50 unchanged lines hidden (view full) ---

425/* Clean up the terminal and readline state after catching a signal, before
426 resending it to the calling application. */
427void
428rl_cleanup_after_signal ()
429{
430 _rl_clean_up_for_exit ();
431 if (rl_deprep_term_function)
432 (*rl_deprep_term_function) ();
393 rl_clear_signals ();
394 rl_clear_pending_input ();
433 rl_clear_pending_input ();
434 rl_clear_signals ();
395}
396
397/* Reset the terminal and readline state after a signal handler returns. */
398void
399rl_reset_after_signal ()
400{
401 if (rl_prep_term_function)
402 (*rl_prep_term_function) (_rl_meta_flag);

--- 24 unchanged lines hidden ---
435}
436
437/* Reset the terminal and readline state after a signal handler returns. */
438void
439rl_reset_after_signal ()
440{
441 if (rl_prep_term_function)
442 (*rl_prep_term_function) (_rl_meta_flag);

--- 24 unchanged lines hidden ---