summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/tty-keys.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2012-11-22 14:26:04 +0000
committernicm <nicm@openbsd.org>2012-11-22 14:26:04 +0000
commit3e0afa48d22ca72f7dad31d02fd4500ee39cd10a (patch)
tree2d8cea999985d431d0866966d5ed2c3058a8c24c /usr.bin/tmux/tty-keys.c
parentDon't need to send DECSL on detaching now, the code using higher levels (diff)
downloadwireguard-openbsd-3e0afa48d22ca72f7dad31d02fd4500ee39cd10a.tar.xz
wireguard-openbsd-3e0afa48d22ca72f7dad31d02fd4500ee39cd10a.zip
Instead of worrying about xterm version, send DA and read DEC service
class which is more likely to be useful. Not used for anything yet anyway.
Diffstat (limited to 'usr.bin/tmux/tty-keys.c')
-rw-r--r--usr.bin/tmux/tty-keys.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c
index 06f6ab7c7ff..466bd80587c 100644
--- a/usr.bin/tmux/tty-keys.c
+++ b/usr.bin/tmux/tty-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-keys.c,v 1.45 2012/10/26 14:35:42 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.46 2012/11/22 14:26:04 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -724,18 +724,17 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size)
int
tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
{
- u_int i, a, b;
+ u_int i, n;
char tmp[64], *endptr;
/*
* Primary device attributes are \033[?a;b and secondary are
- * \033[>a;b;c. We only request attributes on xterm, so we only care
- * about the middle values which is the xterm version.
+ * \033[>a;b;c.
*/
*size = 0;
- /* First three bytes are always \033[>. */
+ /* First three bytes are always \033[?. */
if (buf[0] != '\033')
return (-1);
if (len == 1)
@@ -760,22 +759,17 @@ tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
tmp[i] = '\0';
*size = 4 + i;
- /* Only secondary is of interest. */
- if (buf[2] != '>')
+ /* Only primary is of interest. */
+ if (buf[2] != '?')
return (0);
- /* Convert version numbers. */
- a = strtoul(tmp, &endptr, 10);
- if (*endptr == ';') {
- b = strtoul(endptr + 1, &endptr, 10);
- if (*endptr != '\0' && *endptr != ';')
- b = 0;
- } else
- a = b = 0;
-
- log_debug("received xterm version %u", b);
- if (b < 500)
- tty_set_version(tty, b);
+ /* Convert service class. */
+ n = strtoul(tmp, &endptr, 10);
+ if (*endptr != ';')
+ n = 0;
+
+ log_debug("received service class %u", n);
+ tty->service_class = n;
return (0);
}