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