if (!F_ISSET(sp->gp, G_STDIN_TTY))
if (!F_ISSET(clp, CL_STDIN_TTY))
cl_ex_init(sp)	SCR *sp;{	CL_PRIVATE *clp;	clp = CLP(sp);	/* If already initialized, just set the terminal modes. */	if (F_ISSET(clp, CL_SCR_EX_INIT))		goto fast;	/* If not reading from a file, we're done. */	if (!F_ISSET(sp->gp, G_STDIN_TTY))		return (0);	/* Get the ex termcap/terminfo strings. */	(void)cl_getcap(sp, "cup", &clp->cup);	(void)cl_getcap(sp, "smso", &clp->smso);	(void)cl_getcap(sp, "rmso", &clp->rmso);	(void)cl_getcap(sp, "el", &clp->el);	(void)cl_getcap(sp, "cuu1", &clp->cuu1);	/* Enter_standout_mode and exit_standout_mode are paired. */	if (clp->smso == NULL || clp->rmso == NULL) {		if (clp->smso != NULL) {			free(clp->smso);			clp->smso = NULL;		}		if (clp->rmso != NULL) {			free(clp->rmso);			clp->rmso = NULL;		}	}	/*	 * Turn on canonical mode, with normal input and output processing.	 * Start with the original terminal settings as the user probably	 * had them (including any local extensions) set correctly for the	 * current terminal.	 *	 * !!!	 * We can't get everything that we need portably; for example, ONLCR,	 * mapping <newline> to <carriage-return> on output isn't required	 * by POSIX 1003.1b-1993.  If this turns out to be a problem, then	 * we'll either have to play some games on the mapping, or we'll have	 * to make all ex printf's output \r\n instead of \n.	 */	clp->ex_enter = clp->orig;	clp->ex_enter.c_lflag  |= ECHO | ECHOE | ECHOK | ICANON | IEXTEN | ISIG;#ifdef ECHOCTL	clp->ex_enter.c_lflag |= ECHOCTL;#endif#ifdef ECHOKE	clp->ex_enter.c_lflag |= ECHOKE;#endif	clp->ex_enter.c_iflag |= ICRNL;	clp->ex_enter.c_oflag |= OPOST;#ifdef ONLCR	clp->ex_enter.c_oflag |= ONLCR;#endiffast:	if (tcsetattr(STDIN_FILENO, TCSADRAIN | TCSASOFT, &clp->ex_enter)) {		msgq(sp, M_SYSERR, "tcsetattr");		return (1);	}	return (0);}