diff options
author | nicm <nicm> | 2019-11-28 10:17:22 +0000 |
---|---|---|
committer | nicm <nicm> | 2019-11-28 10:17:22 +0000 |
commit | 08e28285923cb87168ba383011b42aac76925e07 (patch) | |
tree | fb0edc215f03afc31f02dc1e47c596222f6ab028 | |
parent | bc5881c4d2fe0d9172636cfb2d756372995c8359 (diff) |
Parse out DA features.
-rw-r--r-- | screen-write.c | 3 | ||||
-rw-r--r-- | tty-keys.c | 26 |
2 files changed, 15 insertions, 14 deletions
diff --git a/screen-write.c b/screen-write.c index 34d16ee8..43cb42b4 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1636,7 +1636,8 @@ screen_write_overwrite(struct screen_write_ctx *ctx, struct grid_cell *gc, grid_view_get_cell(gd, xx, s->cy, &tmp_gc); if (~tmp_gc.flags & GRID_FLAG_PADDING) break; - log_debug("%s: overwrite at %u,%u", __func__, xx, s->cy); + log_debug("%s: overwrite at %u,%u", __func__, xx, + s->cy); grid_view_set_cell(gd, xx, s->cy, &grid_default_cell); done = 1; } @@ -1002,8 +1002,8 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len, size_t *size) { struct client *c = tty->client; - u_int i, a, b; - char tmp[64], *endptr; + u_int i, n = 0; + char tmp[64], *endptr, p[32] = { 0 }, *cp, *next; static const char *types[] = TTY_TYPES; int type; @@ -1035,23 +1035,21 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len, *size = 4 + i; /* Convert version numbers. */ - a = strtoul(tmp, &endptr, 10); - if (*endptr == ';') { - b = strtoul(endptr + 1, &endptr, 10); + cp = tmp; + while ((next = strsep(&cp, ";")) != NULL) { + p[n] = strtoul(next, &endptr, 10); if (*endptr != '\0' && *endptr != ';') - b = 0; - } else if (*endptr == '\0') - b = 0; - else - a = b = 0; + p[n] = 0; + n++; + } /* Store terminal type. */ type = TTY_UNKNOWN; - switch (a) { + switch (p[0]) { case 1: - if (b == 2) + if (p[1] == 2) type = TTY_VT100; - else if (b == 0) + else if (p[1] == 0) type = TTY_VT101; break; case 6: @@ -1070,6 +1068,8 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len, type = TTY_VT520; break; } + for (i = 2; 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, |