summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/tmux.h3
-rw-r--r--usr.bin/tmux/tty.c83
2 files changed, 2 insertions, 84 deletions
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 5fc68f1b794..63232244ec9 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.121 2009/10/06 07:19:32 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.122 2009/10/09 07:33:12 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1199,7 +1199,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/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 4511036451c..b3deaa38dc9 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.35 2009/10/09 07:23:28 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.36 2009/10/09 07:33:12 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -134,10 +134,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);
@@ -216,83 +212,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;
- int what;
-
- 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");
-
- what = 0;
- if (ioctl(tty->fd, TIOCFLUSH, &what) != 0)
- fatal("ioctl(TIOCFLUSH)");
-
-#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)
{