aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-10-09 13:11:42 +0000
committerTiago Cunha <tcunha@gmx.com>2009-10-09 13:11:42 +0000
commitcddb7811278494452fd2efa5fefc8b2f12043ccd (patch)
tree132c3d4c0588fb0a988ed8b0594a67bcd985ad8f
parent220f3f23846a9809814d430c57fac0aedd59ac1f (diff)
downloadrtmux-cddb7811278494452fd2efa5fefc8b2f12043ccd.tar.gz
rtmux-cddb7811278494452fd2efa5fefc8b2f12043ccd.tar.bz2
rtmux-cddb7811278494452fd2efa5fefc8b2f12043ccd.zip
Sync OpenBSD patchset 368:
The UTF-8 detection idea doesn't work and I am reasonably happy with the current methods, so remove the (already #ifdef 0'd) code.
-rw-r--r--tmux.h3
-rw-r--r--tty.c87
2 files changed, 2 insertions, 88 deletions
diff --git a/tmux.h b/tmux.h
index b1ae4899..7403d452 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.459 2009-10-06 14:14:07 tcunha Exp $ */
+/* $Id: tmux.h,v 1.460 2009-10-09 13:11:42 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1197,7 +1197,6 @@ void tty_init(struct tty *, int, char *);
void tty_resize(struct tty *);
void tty_start_tty(struct tty *);
void tty_stop_tty(struct tty *);
-void tty_detect_utf8(struct tty *);
void tty_set_title(struct tty *, const char *);
void tty_update_mode(struct tty *, int);
void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int);
diff --git a/tty.c b/tty.c
index bea7e502..03e2882f 100644
--- a/tty.c
+++ b/tty.c
@@ -1,4 +1,4 @@
-/* $Id: tty.c,v 1.139 2009-10-09 13:03:28 tcunha Exp $ */
+/* $Id: tty.c,v 1.140 2009-10-09 13:11:42 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -137,10 +137,6 @@ tty_start_tty(struct tty *tty)
if (fcntl(tty->fd, F_SETFL, mode|O_NONBLOCK) == -1)
fatal("fcntl failed");
-#if 0
- tty_detect_utf8(tty);
-#endif
-
if (tcgetattr(tty->fd, &tty->tio) != 0)
fatal("tcgetattr failed");
memcpy(&tio, &tty->tio, sizeof tio);
@@ -221,87 +217,6 @@ tty_stop_tty(struct tty *tty)
tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP));
}
-#if 0
-void
-tty_detect_utf8(struct tty *tty)
-{
- struct pollfd pfd;
- char buf[7];
- size_t len;
- ssize_t n;
- int nfds;
- struct termios tio, old_tio;
-#ifdef TIOCFLUSH
- int what;
-#endif
-
- if (tty->flags & TTY_UTF8)
- return;
-
- /*
- * If the terminal looks reasonably likely to support this, try to
- * write a three-byte UTF-8 wide character to the terminal, then read
- * the cursor position.
- *
- * XXX This entire function is a hack.
- */
-
- /* Check if the terminal looks sort of vt100. */
- if (strstr(tty_term_string(tty->term, TTYC_CLEAR), "[2J") == NULL ||
- strstr(tty_term_string(tty->term, TTYC_CUP), "H") == NULL)
- return;
-
- if (tcgetattr(tty->fd, &old_tio) != 0)
- fatal("tcgetattr failed");
- cfmakeraw(&tio);
- if (tcsetattr(tty->fd, TCSANOW, &tio) != 0)
- fatal("tcsetattr failed");
-
-#ifdef TIOCFLUSH
- what = 0;
- if (ioctl(tty->fd, TIOCFLUSH, &what) != 0)
- fatal("ioctl(TIOCFLUSH)");
-#endif
-
-#define UTF8_TEST_DATA "\033[H\357\277\246\033[6n"
- if (write(tty->fd, UTF8_TEST_DATA, (sizeof UTF8_TEST_DATA) - 1) == -1)
- fatal("write failed");
-#undef UTF8_TEST_DATA
-
- len = 0;
- for (;;) {
- pfd.fd = tty->fd;
- pfd.events = POLLIN;
-
- nfds = poll(&pfd, 1, 500);
- if (nfds == -1) {
- if (errno == EAGAIN || errno == EINTR)
- continue;
- fatal("poll failed");
- }
- if (nfds == 0)
- break;
- if (pfd.revents & (POLLERR|POLLNVAL|POLLHUP))
- break;
- if (!(pfd.revents & POLLIN))
- continue;
-
- if ((n = read(tty->fd, buf + len, 1)) != 1)
- break;
- buf[++len] = '\0';
-
- if (len == (sizeof buf) - 1) {
- if (strcmp(buf, "\033[1;3R") == 0)
- tty->flags |= TTY_UTF8;
- break;
- }
- }
-
- if (tcsetattr(tty->fd, TCSANOW, &old_tio) != 0)
- fatal("tcsetattr failed");
-}
-#endif
-
void
tty_fill_acs(struct tty *tty)
{