Commit | Line | Data |
---|---|---|
b059c7be | 1 | /* |
2f14f200 KB |
2 | * Copyright (c) 1981 Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
7e3eac84 | 5 | * %sccs.include.redist.c% |
b059c7be DF |
6 | */ |
7 | ||
8 | #ifndef lint | |
7b08903b | 9 | static char sccsid[] = "@(#)tstp.c 5.6 (Berkeley) %G%"; |
2f14f200 | 10 | #endif /* not lint */ |
b059c7be | 11 | |
bd2eadcc KA |
12 | # include <signal.h> |
13 | ||
bd2eadcc KA |
14 | # include "curses.ext" |
15 | ||
16 | /* | |
17 | * handle stop and start signals | |
18 | * | |
7b08903b | 19 | * @(#)tstp.c 5.6 (Berkeley) %G% |
bd2eadcc | 20 | */ |
7b08903b | 21 | void |
bd2eadcc KA |
22 | tstp() { |
23 | ||
166537b0 KA |
24 | # ifdef SIGTSTP |
25 | ||
bd2eadcc | 26 | SGTTY tty; |
7e8a2685 | 27 | int omask; |
bd2eadcc KA |
28 | # ifdef DEBUG |
29 | if (outf) | |
30 | fflush(outf); | |
31 | # endif | |
32 | tty = _tty; | |
33 | mvcur(0, COLS - 1, LINES - 1, 0); | |
34 | endwin(); | |
35 | fflush(stdout); | |
7e8a2685 SL |
36 | /* reset signal handler so kill below stops us */ |
37 | signal(SIGTSTP, SIG_DFL); | |
38 | #define mask(s) (1 << ((s)-1)) | |
39 | omask = sigsetmask(sigblock(0) &~ mask(SIGTSTP)); | |
bd2eadcc | 40 | kill(0, SIGTSTP); |
7e8a2685 | 41 | sigblock(mask(SIGTSTP)); |
bd2eadcc KA |
42 | signal(SIGTSTP, tstp); |
43 | _tty = tty; | |
d6e8b8ca | 44 | ioctl(_tty_ch, TIOCSETP, &_tty); |
bd2eadcc | 45 | wrefresh(curscr); |
166537b0 | 46 | # endif SIGTSTP |
bd2eadcc | 47 | } |