1 /* $OpenBSD: spawn.c,v 1.8 2003/05/20 03:08:55 cloder Exp $ */ 2 3 /* 4 * Spawn. Actually just suspends Mg. 5 * Assumes POSIX job control. 6 */ 7 8 #include "def.h" 9 10 #include <signal.h> 11 #include <termios.h> 12 #include <term.h> 13 14 /* 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 17 * screen, we will switch to it. 18 */ 19 /* ARGSUSED */ 20 int 21 spawncli(int f, int n) 22 { 23 sigset_t oset; 24 25 /* Very similar to what vttidy() does. */ 26 ttcolor(CTEXT); 27 ttnowindow(); 28 ttmove(nrow - 1, 0); 29 if (epresf != FALSE) { 30 tteeol(); 31 epresf = FALSE; 32 } 33 if (ttcooked() == FALSE) 34 return(FALSE); 35 36 /* Exit application mode and tidy. */ 37 tttidy(); 38 ttflush(); 39 (void)sigprocmask(SIG_SETMASK, NULL, &oset); 40 (void)kill(0, SIGTSTP); 41 (void)sigprocmask(SIG_SETMASK, &oset, NULL); 42 ttreinit(); 43 44 /* Force repaint. */ 45 sgarbf = TRUE; 46 return ttraw(); 47 } 48