[BACK]Return to spawn.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Annotation of src/usr.bin/mg/spawn.c, Revision 1.5

1.1       deraadt     1: /*
1.3       millert     2:  * Spawn.  Actually just suspends Mg.
                      3:  * Assumes POSIX job control.
1.1       deraadt     4:  */
                      5:
1.5     ! millert     6: #include "def.h"
        !             7:
        !             8: #include <signal.h>
        !             9: #include <termios.h>
        !            10: #include <term.h>
1.1       deraadt    11:
                     12: /*
1.5     ! millert    13:  * This causes mg to send itself a stop signal.  It assumes the parent
        !            14:  * shell supports POSIX job control.  If the terminal supports an alternate
        !            15:  * screen, we will switch to it.
1.1       deraadt    16:  */
1.3       millert    17: /* ARGSUSED */
1.5     ! millert    18: int
1.1       deraadt    19: spawncli(f, n)
1.5     ! millert    20:        int f, n;
1.1       deraadt    21: {
1.5     ! millert    22:        sigset_t        oset;
1.1       deraadt    23:
1.3       millert    24:        /* Very similar to what vttidy() does. */
1.1       deraadt    25:        ttcolor(CTEXT);
                     26:        ttnowindow();
1.3       millert    27:        ttmove(nrow - 1, 0);
1.1       deraadt    28:        if (epresf != FALSE) {
                     29:                tteeol();
                     30:                epresf = FALSE;
                     31:        }
1.3       millert    32:        if (ttcooked() == FALSE)
1.5     ! millert    33:                return(FALSE);
        !            34:
        !            35:        /* Exit application mode and tidy. */
        !            36:        tttidy();
1.3       millert    37:        ttflush();
1.5     ! millert    38:        (void)sigprocmask(SIG_SETMASK, NULL, &oset);
        !            39:        (void)kill(0, SIGTSTP);
        !            40:        (void)sigprocmask(SIG_SETMASK, &oset, NULL);
1.3       millert    41:        ttreinit();
1.5     ! millert    42:
        !            43:        /* Force repaint. */
        !            44:        sgarbf = TRUE;
1.3       millert    45:        return ttraw();
1.1       deraadt    46: }