From deb734c7f61c36e18ccc2e4fdab4f06a90575fc9 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 12 Jan 2020 20:20:20 +0000 Subject: Loop over all DA features, don't skip the first. --- tty-keys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tty-keys.c') diff --git a/tty-keys.c b/tty-keys.c index 6be40d0e..1d97b7d2 100644 --- a/tty-keys.c +++ b/tty-keys.c @@ -1038,7 +1038,7 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len, cp = tmp; while ((next = strsep(&cp, ";")) != NULL) { p[n] = strtoul(next, &endptr, 10); - if (*endptr != '\0' && *endptr != ';') + if (*endptr != '\0') p[n] = 0; n++; } @@ -1068,7 +1068,7 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len, type = TTY_VT520; break; } - for (i = 2; i < n; i++) + for (i = 1; i < n; i++) log_debug("%s: DA feature: %d", c->name, p[i]); tty_set_type(tty, type); -- cgit From 193e637de050e3757698812e9a87b869c87def6c Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 12 Jan 2020 21:07:07 +0000 Subject: The terminal type was never as much use as I expected so remove it in favour of a couple of flags for the features used (DECSLRM and DECFRA). Also rename the flag for no xenl to be more obvious while here. --- tty-keys.c | 40 +++++++++------------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) (limited to 'tty-keys.c') diff --git a/tty-keys.c b/tty-keys.c index 1d97b7d2..4644340c 100644 --- a/tty-keys.c +++ b/tty-keys.c @@ -1001,11 +1001,10 @@ static int tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len, size_t *size) { - struct client *c = tty->client; - u_int i, n = 0; - char tmp[64], *endptr, p[32] = { 0 }, *cp, *next; - static const char *types[] = TTY_TYPES; - int type; + struct client *c = tty->client; + u_int i, n = 0; + char tmp[64], *endptr, p[32] = { 0 }, *cp, *next; + int flags = 0; *size = 0; @@ -1043,36 +1042,15 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len, n++; } - /* Store terminal type. */ - type = TTY_UNKNOWN; + /* Set terminal flags. */ switch (p[0]) { - case 1: - if (p[1] == 2) - type = TTY_VT100; - else if (p[1] == 0) - type = TTY_VT101; - break; - case 6: - type = TTY_VT102; - break; - case 62: - type = TTY_VT220; - break; - case 63: - type = TTY_VT320; - break; - case 64: - type = TTY_VT420; - break; - case 65: - type = TTY_VT520; + case 64: /* VT420 */ + flags |= (TERM_DECFRA|TERM_DECSLRM); break; } for (i = 1; i < n; i++) log_debug("%s: DA feature: %d", c->name, p[i]); - tty_set_type(tty, type); - - log_debug("%s: received DA %.*s (%s)", c->name, (int)*size, buf, - types[type]); + log_debug("%s: received DA %.*s", c->name, (int)*size, buf); + tty_set_flags(tty, flags); return (0); } -- cgit