Annotation of src/usr.bin/mg/spawn.c, Revision 1.12
1.12 ! bcallah 1: /* $OpenBSD: spawn.c,v 1.11 2006/08/01 22:16:03 jason 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.12 ! bcallah 10: #include <sys/queue.h>
! 11: #include <signal.h>
! 12: #include <stdio.h>
! 13: #include <term.h>
! 14: #include <termios.h>
! 15:
1.5 millert 16: #include "def.h"
1.1 deraadt 17:
18: /*
1.7 mickey 19: * This causes mg to send itself a stop signal. It assumes the parent
20: * shell supports POSIX job control. If the terminal supports an alternate
1.5 millert 21: * screen, we will switch to it.
1.1 deraadt 22: */
1.3 millert 23: /* ARGSUSED */
1.5 millert 24: int
1.8 cloder 25: spawncli(int f, int n)
1.1 deraadt 26: {
1.5 millert 27: sigset_t oset;
1.1 deraadt 28:
1.3 millert 29: /* Very similar to what vttidy() does. */
1.1 deraadt 30: ttcolor(CTEXT);
31: ttnowindow();
1.3 millert 32: ttmove(nrow - 1, 0);
1.1 deraadt 33: if (epresf != FALSE) {
34: tteeol();
35: epresf = FALSE;
36: }
1.3 millert 37: if (ttcooked() == FALSE)
1.9 db 38: return (FALSE);
1.5 millert 39:
40: /* Exit application mode and tidy. */
41: tttidy();
1.3 millert 42: ttflush();
1.5 millert 43: (void)sigprocmask(SIG_SETMASK, NULL, &oset);
44: (void)kill(0, SIGTSTP);
45: (void)sigprocmask(SIG_SETMASK, &oset, NULL);
1.3 millert 46: ttreinit();
1.5 millert 47:
48: /* Force repaint. */
49: sgarbf = TRUE;
1.9 db 50: return (ttraw());
1.1 deraadt 51: }