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