fix for new signals
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Sun, 26 Jun 1983 13:34:26 +0000 (05:34 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Sun, 26 Jun 1983 13:34:26 +0000 (05:34 -0800)
SCCS-vsn: lib/libcurses/tstp.c 1.3

usr/src/lib/libcurses/tstp.c

index ce066ee..b71a61f 100644 (file)
@@ -12,6 +12,7 @@ tstp() {
 # ifdef SIGTSTP
 
        SGTTY   tty;
 # ifdef SIGTSTP
 
        SGTTY   tty;
+       int     omask;
 # ifdef DEBUG
        if (outf)
                fflush(outf);
 # ifdef DEBUG
        if (outf)
                fflush(outf);
@@ -20,7 +21,12 @@ tstp() {
        mvcur(0, COLS - 1, LINES - 1, 0);
        endwin();
        fflush(stdout);
        mvcur(0, COLS - 1, LINES - 1, 0);
        endwin();
        fflush(stdout);
+       /* reset signal handler so kill below stops us */
+       signal(SIGTSTP, SIG_DFL);
+#define        mask(s) (1 << ((s)-1))
+       omask = sigsetmask(sigblock(0) &~ mask(SIGTSTP));
        kill(0, SIGTSTP);
        kill(0, SIGTSTP);
+       sigblock(mask(SIGTSTP));
        signal(SIGTSTP, tstp);
        _tty = tty;
        stty(_tty_ch, &_tty);
        signal(SIGTSTP, tstp);
        _tty = tty;
        stty(_tty_ch, &_tty);