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