示例#1
0
文件: termio.c 项目: ricksladkey/vile
void
ttopen(void)
{
    vl_save_tty();

#if !DISP_X11
#ifdef HAVE_SETVBUF
# ifdef SETVBUF_REVERSED
    setvbuf(stdout, _IOFBF, tobuf, TBUFSIZ);
# else
    setvbuf(stdout, tobuf, _IOFBF, (size_t) TBUFSIZ);
# endif
#else /* !HAVE_SETVBUF */
    setbuffer(stdout, tobuf, TBUFSIZ);
#endif /* !HAVE_SETVBUF */
#endif /* !DISP_X11 */

    /* this could probably be done more POSIX'ish? */
#if OPT_SHELL && defined(SIGTSTP) && defined(SIGCONT)
    setup_handler(SIGTSTP, SIG_DFL);	/* set signals so that we can */
    setup_handler(SIGCONT, rtfrmshell);		/* suspend & restart */
#endif
#ifdef SIGTTOU
    setup_handler(SIGTTOU, SIG_IGN);	/* ignore output prevention */
#endif

#if ! DISP_X11
    ntermios = otermios;

    /* new input settings: turn off crnl mapping, cr-ignoring,
     * case-conversion, and allow BREAK
     */
    ntermios.c_iflag = BRKINT | (otermios.c_iflag &
				 (ULONG) ~ (INLCR | IGNCR | ICRNL
#ifdef IUCLC
					    | IUCLC
#endif
				 ));

    ntermios.c_oflag = 0;
    ntermios.c_lflag = ISIG;
    ntermios.c_cc[VMIN] = 1;
    ntermios.c_cc[VTIME] = 0;
#ifdef	VSWTCH
    ntermios.c_cc[VSWTCH] = VDISABLE;
#endif
    ntermios.c_cc[VSUSP] = VDISABLE;
#if defined (VDSUSP) && defined(NCCS) && VDSUSP < NCCS
    ntermios.c_cc[VDSUSP] = VDISABLE;
#endif
    ntermios.c_cc[VSTART] = VDISABLE;
    ntermios.c_cc[VSTOP] = VDISABLE;
#endif /* ! DISP_X11 */

    ttmiscinit();

    term.unclean();
}
示例#2
0
文件: termio.c 项目: ricksladkey/vile
void
ttopen(void)
{
    vl_save_tty();

#if ! DISP_X11
    nstate = ostate;
    nstate.sg_flags |= CBREAK;
    nstate.sg_flags &= ~(ECHO | CRMOD);		/* no echo for now... */
    ioctl(0, TIOCSETN, (char *) &nstate);	/* set new state */
#endif

    rnstate = nstate;
    rnstate.sg_flags &= ~CBREAK;
    rnstate.sg_flags |= RAW;

#if ! DISP_X11
    ntchars = otchars;
    ntchars.t_brkc = -1;
    ntchars.t_eofc = -1;
    ntchars.t_startc = -1;
    ntchars.t_stopc = -1;
    ioctl(0, TIOCSETC, (char *) &ntchars);	/* Place new character into K */
    ioctl(0, TIOCSLTC, (char *) &nltchars);	/* Place new character into K */

#ifdef	TIOCLGET
    nlstate = olstate;
    nlstate |= LLITOUT;
    ioctl(0, TIOCLSET, (char *) &nlstate);
#endif

#if OPT_SHELL
    setup_handler(SIGTSTP, SIG_DFL);	/* set signals so that we can */
    setup_handler(SIGCONT, rtfrmshell);		/* suspend & restart */
#endif
    setup_handler(SIGTTOU, SIG_IGN);	/* ignore output prevention */
#endif

#if USE_FIONREAD
    setbuffer(stdout, tobuf, TBUFSIZ);
#endif
    ttmiscinit();
}
示例#3
0
文件: termio.c 项目: ricksladkey/vile
void
ttopen(void)
{
    vl_save_tty();

#if defined(HAVE_SETBUFFER) && !DISP_X11
    setbuffer(stdout, tobuf, TBUFSIZ);
#endif

#if SIGTSTP
/* be careful here -- VSUSP is sometimes out of the range of the c_cc array */
#ifdef V_SUSP
    ntermio.c_cc[V_SUSP] = -1;
#endif
#ifdef V_DSUSP
    ntermio.c_cc[V_DSUSP] = -1;
#endif

#if OPT_SHELL
    setup_handler(SIGTSTP, SIG_DFL);	/* set signals so that we can */
    setup_handler(SIGCONT, rtfrmshell);		/* suspend & restart */
#endif
    setup_handler(SIGTTOU, SIG_IGN);	/* ignore output prevention */
#endif

#if ! DISP_X11
    ntermio = otermio;

    /* setup new settings, allow BREAK */
    ntermio.c_iflag = BRKINT;
    ntermio.c_oflag = 0;
    ntermio.c_lflag = ISIG;
    ntermio.c_cc[VMIN] = 1;
    ntermio.c_cc[VTIME] = 0;
#ifdef	VSWTCH
    ntermio.c_cc[VSWTCH] = -1;
#endif
#endif

    ttmiscinit();
    term.unclean();
}
void
ttopen()
{
	int s;
	s = tcgetattr(0, &otermios);
	if (s < 0) {
		perror("ttopen tcgetattr");
		ExitProgram(BAD(1));
	}
 /* the "|| USG" below is to support SVR4 -- let me know if
 	it conflicts on other systems */
#if ODT || ISC || USG
	setvbuf(stdout, tobuf, _IOLBF, TBUFSIZ);
#else
  	setbuffer(stdout, tobuf, TBUFSIZ);
#endif

	suspc =   otermios.c_cc[VSUSP];
	intrc =   otermios.c_cc[VINTR];
	killc =   otermios.c_cc[VKILL];
	startc =  otermios.c_cc[VSTART];
	stopc =   otermios.c_cc[VSTOP];
	backspc = otermios.c_cc[VERASE];
#ifdef VWERASE  /* Sun has it.  any others? */
	wkillc = otermios.c_cc[VWERASE];
#else
	wkillc =  tocntrl('W');
#endif

	/* this could probably be done more POSIX'ish? */
	(void)signal(SIGTSTP,SIG_DFL);		/* set signals so that we can */
	(void)signal(SIGCONT,rtfrmshell);	/* suspend & restart */
	(void)signal(SIGTTOU,SIG_IGN);		/* ignore output prevention */

#if USE_FCNTL
	kbd_flags = fcntl( 0, F_GETFL, 0 );
	kbd_is_polled = FALSE;
#endif

#if ! X11
	ntermios = otermios;

	/* setup new settings, preserve flow control, and allow BREAK */
	ntermios.c_iflag = BRKINT|(otermios.c_iflag & (IXON|IXANY|IXOFF));
	ntermios.c_oflag = 0;
	ntermios.c_lflag = ISIG;
	ntermios.c_cc[VMIN] = 1;
	ntermios.c_cc[VTIME] = 0;
#ifdef	VSWTCH
	ntermios.c_cc[VSWTCH] = -1;
#endif
	ntermios.c_cc[VSUSP] = -1;
	ntermios.c_cc[VSTART] = -1;
	ntermios.c_cc[VSTOP] = -1;
#endif

	ttmiscinit();

	ttunclean();


}