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