* Copyright (c) 1981 Regents of the University of California.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)tstp.c 8.1 (Berkeley) %G%";
__stop_signal_handler(signo
)
/* Get the current terminal state (which the user may have changed). */
if (tcgetattr(STDIN_FILENO
, &save
))
* Block every signal we can get our hands on. This is because
* applications have timers going off that want to repaint the
(void)sigprocmask(SIG_BLOCK
, &set
, &oset
);
* End the window, which also resets the terminal state to the
(void)sigaddset(&set
, SIGTSTP
);
(void)sigprocmask(SIG_UNBLOCK
, &set
, NULL
);
/* Reset the curses SIGTSTP signal handler. */
/* save the new "default" terminal state */
(void)tcgetattr(STDIN_FILENO
, &__orig_termios
);
/* Reset the terminal state to the mode just before we stopped. */
(void)tcsetattr(STDIN_FILENO
, __tcaction
, &save
);
/* Restart the screen. */
/* Repaint the screen. */
(void)sigprocmask(SIG_SETMASK
, &oset
, NULL
);
static void (*otstpfn
)() = SIG_DFL
;
otstpfn
= signal(SIGTSTP
, __stop_signal_handler
);
* Restore the TSTP handler.
(void)signal(SIGTSTP
, otstpfn
);