1 /* $OpenBSD: spawn.c,v 1.11 2006/08/01 22:16:03 jason Exp $ */ 2 3 /* This file is in the public domain. */ 4 5 /* 6 * Spawn. Actually just suspends Mg. 7 * Assumes POSIX job control. 8 */ 9 10 #include "def.h" 11 12 #include <termios.h> 13 #include <term.h> 14 15 /* 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 18 * screen, we will switch to it. 19 */ 20 /* ARGSUSED */ 21 int 22 spawncli(int f, int 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