1 /* $OpenBSD: spawn.c,v 1.7 2001/05/24 03:05:26 mickey 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(f, n) 22 int f, n; 23 { 24 sigset_t oset; 25 26 /* Very similar to what vttidy() does. */ 27 ttcolor(CTEXT); 28 ttnowindow(); 29 ttmove(nrow - 1, 0); 30 if (epresf != FALSE) { 31 tteeol(); 32 epresf = FALSE; 33 } 34 if (ttcooked() == FALSE) 35 return(FALSE); 36 37 /* Exit application mode and tidy. */ 38 tttidy(); 39 ttflush(); 40 (void)sigprocmask(SIG_SETMASK, NULL, &oset); 41 (void)kill(0, SIGTSTP); 42 (void)sigprocmask(SIG_SETMASK, &oset, NULL); 43 ttreinit(); 44 45 /* Force repaint. */ 46 sgarbf = TRUE; 47 return ttraw(); 48 } 49