=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tty.c,v retrieving revision 1.126 retrieving revision 1.127 diff -c -r1.126 -r1.127 *** src/usr.bin/tmux/tty.c 2012/03/17 19:29:46 1.126 --- src/usr.bin/tmux/tty.c 2012/03/17 21:27:51 1.127 *************** *** 1,4 **** ! /* $OpenBSD: tty.c,v 1.126 2012/03/17 19:29:46 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: tty.c,v 1.127 2012/03/17 21:27:51 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 175,192 **** } void ! tty_start_tty(struct tty *tty) { struct termios tio; ! if (tty->fd == -1 || tcgetattr(tty->fd, &tty->tio) != 0) return; ! setblocking(tty->fd, 0); ! bufferevent_enable(tty->event, EV_READ|EV_WRITE); ! memcpy(&tio, &tty->tio, sizeof tio); tio.c_iflag &= ~(IXON|IXOFF|ICRNL|INLCR|IGNCR|IMAXBEL|ISTRIP); tio.c_iflag |= IGNBRK; tio.c_oflag &= ~(OPOST|ONLCR|OCRNL|ONLRET); --- 175,193 ---- } void ! tty_init_termios(int fd, struct termios *orig_tio, struct bufferevent *bufev) { struct termios tio; ! if (fd == -1 || tcgetattr(fd, orig_tio) != 0) return; ! setblocking(fd, 0); ! if (bufev != NULL) ! bufferevent_enable(bufev, EV_READ|EV_WRITE); ! memcpy(&tio, orig_tio, sizeof tio); tio.c_iflag &= ~(IXON|IXOFF|ICRNL|INLCR|IGNCR|IMAXBEL|ISTRIP); tio.c_iflag |= IGNBRK; tio.c_oflag &= ~(OPOST|ONLCR|OCRNL|ONLRET); *************** *** 194,201 **** ECHOPRT|ECHOKE|ECHOCTL|ISIG); tio.c_cc[VMIN] = 1; tio.c_cc[VTIME] = 0; ! if (tcsetattr(tty->fd, TCSANOW, &tio) == 0) ! tcflush(tty->fd, TCIOFLUSH); tty_putcode(tty, TTYC_SMCUP); --- 195,208 ---- ECHOPRT|ECHOKE|ECHOCTL|ISIG); tio.c_cc[VMIN] = 1; tio.c_cc[VTIME] = 0; ! if (tcsetattr(fd, TCSANOW, &tio) == 0) ! tcflush(fd, TCIOFLUSH); ! } ! ! void ! tty_start_tty(struct tty *tty) ! { ! tty_init_termios(tty->fd, &tty->tio, tty->event); tty_putcode(tty, TTYC_SMCUP);