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