Annotation of src/usr.bin/mg/spawn.c, Revision 1.11
1.11 ! jason 1: /* $OpenBSD: spawn.c,v 1.10 2005/06/14 18:14:40 kjell Exp $ */
1.10 kjell 2:
3: /* This file is in the public domain. */
1.6 niklas 4:
1.1 deraadt 5: /*
1.3 millert 6: * Spawn. Actually just suspends Mg.
7: * Assumes POSIX job control.
1.1 deraadt 8: */
9:
1.5 millert 10: #include "def.h"
11:
12: #include <termios.h>
13: #include <term.h>
1.1 deraadt 14:
15: /*
1.7 mickey 16: * This causes mg to send itself a stop signal. It assumes the parent
17: * shell supports POSIX job control. If the terminal supports an alternate
1.5 millert 18: * screen, we will switch to it.
1.1 deraadt 19: */
1.3 millert 20: /* ARGSUSED */
1.5 millert 21: int
1.8 cloder 22: spawncli(int f, int 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.9 db 35: return (FALSE);
1.5 millert 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.9 db 47: return (ttraw());
1.1 deraadt 48: }