if (F_ISSET(gp, G_STDIN_TTY)) {
if (F_ISSET(clp, CL_STDIN_TTY)) {
cl_suspend(sp, allowedp)	SCR *sp;	int *allowedp;{	struct termios t;	CL_PRIVATE *clp;	GS *gp;	size_t oldy, oldx;	int changed;	gp = sp->gp;	clp = CLP(sp);	*allowedp = 1;	/*	 * The ex implementation of this function isn't needed by screens not	 * supporting ex commands that require full terminal canonical mode	 * (e.g. :suspend).	 *	 * The vi implementation of this function isn't needed by screens not	 * supporting vi process suspension, i.e. any screen that isn't backed	 * by a UNIX shell.	 *	 * Setting allowedp to 0 will cause the editor to reject the command.	 */	if (F_ISSET(sp, SC_EX)) { 		/* Save the terminal settings, and restore the original ones. */		if (F_ISSET(gp, G_STDIN_TTY)) {			(void)tcgetattr(STDIN_FILENO, &t);			(void)tcsetattr(STDIN_FILENO,			    TCSASOFT | TCSADRAIN, &clp->orig);		}		/* Stop the process group. */		(void)kill(0, SIGTSTP);		/* Time passes ... */		/* Restore terminal settings. */		if (F_ISSET(gp, G_STDIN_TTY))			(void)tcsetattr(STDIN_FILENO, TCSASOFT | TCSADRAIN, &t);		return (0);	}	/*	 * Move to the lower left-hand corner of the screen.	 *	 * XXX	 * Not sure this is necessary in System V implementations, but it	 * shouldn't hurt.	 */	getyx(stdscr, oldy, oldx);	(void)move(LINES - 1, 0);	(void)refresh();	/*	 * Temporarily end the screen.  System V introduced a semantic where	 * endwin() could be restarted.  We use it because restarting curses	 * from scratch often fails in System V.  4BSD curses didn't support	 * restarting after endwin(), so we have to do what clean up we can	 * without calling it.	 */#ifdef HAVE_BSD_CURSES	/* Save the terminal settings. */	(void)tcgetattr(STDIN_FILENO, &t);#endif	/* Restore the cursor keys to normal mode. */	(void)keypad(stdscr, FALSE);	/* Restore the window name. */	(void)cl_rename(sp, NULL, 0);#ifdef HAVE_BSD_CURSES	(void)cl_attr(sp, SA_ALTERNATE, 0);#else	(void)endwin();#endif	/*	 * XXX	 * Restore the original terminal settings.  This is bad -- the	 * reset can cause character loss from the tty queue.  However,	 * we can't call endwin() in BSD curses implementations, and too	 * many System V curses implementations don't get it right.	 */	(void)tcsetattr(STDIN_FILENO, TCSADRAIN | TCSASOFT, &clp->orig);	/* Stop the process group. */	(void)kill(0, SIGTSTP);	/* Time passes ... */	/*	 * If we received a killer signal, we're done.  Leave everything	 * unchanged.  In addition, the terminal has already been reset	 * correctly, so leave it alone.	 */	if (clp->killersig) {		F_CLR(clp, CL_SCR_EX_INIT | CL_SCR_VI_INIT);		return (0);	}#ifdef HAVE_BSD_CURSES	/* Restore terminal settings. */	if (F_ISSET(gp, G_STDIN_TTY))		(void)tcsetattr(STDIN_FILENO, TCSASOFT | TCSADRAIN, &t);	(void)cl_attr(sp, SA_ALTERNATE, 1);#endif	/* Set the window name. */	(void)cl_rename(sp, sp->frp->name, 1);	/* Put the cursor keys into application mode. */	(void)keypad(stdscr, TRUE);	/* Refresh and repaint the screen. */	(void)move(oldy, oldx);	(void)cl_refresh(sp, 1);	/* If the screen changed size, set the SIGWINCH bit. */	if (cl_ssize(sp, 1, NULL, NULL, &changed))		return (1);	if (changed)		F_SET(CLP(sp), CL_SIGWINCH);	return (0);}