Exemplo n.º 1
0
void
tty_putcode2(struct tty *tty, enum tty_code_code code, int a, int b)
{
	if (a < 0 || b < 0)
		return;
	tty_puts(tty, tty_term_string2(tty->term, code, a, b));
}
Exemplo n.º 2
0
void
tty_stop_tty(struct tty *tty)
{
	struct winsize	ws;

	/*
	 * Be flexible about error handling and try not kill the server just
	 * because the fd is invalid. Things like ssh -t can easily leave us
	 * with a dead tty.
	 */
	if (ioctl(tty->fd, TIOCGWINSZ, &ws) == -1)
		return;
	if (tcsetattr(tty->fd, TCSANOW, &tty->tio) == -1)
		return;

	tty_raw(tty, tty_term_string2(tty->term, TTYC_CSR, 0, ws.ws_row - 1));
	tty_raw(tty, tty_term_string(tty->term, TTYC_RMACS));
	tty_raw(tty, tty_term_string(tty->term, TTYC_SGR0));
	tty_raw(tty, tty_term_string(tty->term, TTYC_RMKX));
	tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP));
	tty_raw(tty, tty_term_string(tty->term, TTYC_CLEAR));

	tty_raw(tty, tty_term_string(tty->term, TTYC_CNORM));
	if (tty_term_has(tty->term, TTYC_KMOUS))
		tty_raw(tty, "\033[?1000l");
}
Exemplo n.º 3
0
Arquivo: tty.c Projeto: UNGLinux/Obase
void
tty_stop_tty(struct tty *tty)
{
	struct winsize	ws;

	if (!(tty->flags & TTY_STARTED))
		return;
	tty->flags &= ~TTY_STARTED;

	bufferevent_disable(tty->event, EV_READ|EV_WRITE);

	/*
	 * Be flexible about error handling and try not kill the server just
	 * because the fd is invalid. Things like ssh -t can easily leave us
	 * with a dead tty.
	 */
	if (ioctl(tty->fd, TIOCGWINSZ, &ws) == -1)
		return;
	if (tcsetattr(tty->fd, TCSANOW, &tty->tio) == -1)
		return;

	setblocking(tty->fd, 1);

	tty_raw(tty, tty_term_string2(tty->term, TTYC_CSR, 0, ws.ws_row - 1));
	if (tty_use_acs(tty))
		tty_raw(tty, tty_term_string(tty->term, TTYC_RMACS));
	tty_raw(tty, tty_term_string(tty->term, TTYC_SGR0));
	tty_raw(tty, tty_term_string(tty->term, TTYC_RMKX));
	tty_raw(tty, tty_term_string(tty->term, TTYC_CLEAR));
	if (tty_term_has(tty->term, TTYC_CS1) && tty->cstyle != 0) {
		if (tty_term_has(tty->term, TTYC_CSR1))
			tty_raw(tty, tty_term_string(tty->term, TTYC_CSR1));
		else
			tty_raw(tty, tty_term_string1(tty->term, TTYC_CS1, 0));
	}
	tty_raw(tty, tty_term_string(tty->term, TTYC_CR));

	tty_raw(tty, tty_term_string(tty->term, TTYC_CNORM));
	if (tty_term_has(tty->term, TTYC_KMOUS))
		tty_raw(tty, "\033[?1000l");

	tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP));

	if (tty->xterm_version > 270)
		tty_raw(tty, "\033[61;1\"p");
}
Exemplo n.º 4
0
Arquivo: tty.c Projeto: jnbek/tmux
void
tty_stop_tty(struct tty *tty)
{
    struct winsize	ws;
    int		mode;

    if (!(tty->flags & TTY_STARTED))
        return;
    tty->flags &= ~TTY_STARTED;

    bufferevent_disable(tty->event, EV_READ|EV_WRITE);

    /*
     * Be flexible about error handling and try not kill the server just
     * because the fd is invalid. Things like ssh -t can easily leave us
     * with a dead tty.
     */
    if (ioctl(tty->fd, TIOCGWINSZ, &ws) == -1)
        return;
    if (tcsetattr(tty->fd, TCSANOW, &tty->tio) == -1)
        return;

    tty_raw(tty, tty_term_string2(tty->term, TTYC_CSR, 0, ws.ws_row - 1));
    tty_raw(tty, tty_term_string(tty->term, TTYC_RMACS));
    tty_raw(tty, tty_term_string(tty->term, TTYC_SGR0));
    tty_raw(tty, tty_term_string(tty->term, TTYC_RMKX));
    tty_raw(tty, tty_term_string(tty->term, TTYC_CLEAR));

    tty_raw(tty, tty_term_string(tty->term, TTYC_CNORM));
    if (tty_term_has(tty->term, TTYC_KMOUS))
        tty_raw(tty, "\033[?1000l");

    tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP));

    if ((mode = fcntl(tty->fd, F_GETFL)) != -1)
        fcntl(tty->fd, F_SETFL, mode & ~O_NONBLOCK);
}