[BACK]Return to spawn.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

File: [local] / src / usr.bin / mg / spawn.c (download)

Revision 1.7, Thu May 24 03:05:26 2001 UTC (23 years ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2, OPENBSD_3_1_BASE, OPENBSD_3_1, OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.6: +3 -3 lines

spaces

/*	$OpenBSD: spawn.c,v 1.7 2001/05/24 03:05:26 mickey Exp $	*/

/*
 * Spawn.  Actually just suspends Mg.
 * Assumes POSIX job control.
 */

#include "def.h"

#include <signal.h>
#include <termios.h>
#include <term.h>

/*
 * This causes mg to send itself a stop signal.  It assumes the parent
 * shell supports POSIX job control.  If the terminal supports an alternate
 * screen, we will switch to it.
 */
/* ARGSUSED */
int
spawncli(f, n)
	int f, n;
{
	sigset_t	oset;

	/* Very similar to what vttidy() does. */
	ttcolor(CTEXT);
	ttnowindow();
	ttmove(nrow - 1, 0);
	if (epresf != FALSE) {
		tteeol();
		epresf = FALSE;
	}
	if (ttcooked() == FALSE)
		return(FALSE);

	/* Exit application mode and tidy. */
	tttidy();
	ttflush();
	(void)sigprocmask(SIG_SETMASK, NULL, &oset);
	(void)kill(0, SIGTSTP);
	(void)sigprocmask(SIG_SETMASK, &oset, NULL);
	ttreinit();

	/* Force repaint. */
	sgarbf = TRUE;
	return ttraw();
}