summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/server-client.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2021-02-17 07:18:36 +0000
committernicm <nicm@openbsd.org>2021-02-17 07:18:36 +0000
commitc05282f8eea07b70b4f0e3905b9849fff97f0f85 (patch)
tree872feac23f12b999b0a143474eaba56dd25f07ce /usr.bin/tmux/server-client.c
parentCollect return code of video_stop() for ioctls calls. (diff)
downloadwireguard-openbsd-c05282f8eea07b70b4f0e3905b9849fff97f0f85.tar.xz
wireguard-openbsd-c05282f8eea07b70b4f0e3905b9849fff97f0f85.zip
Move the call to setupterm() into the client and have it pass the
results to the server over imsg, means the server does not need to enter ncurses or read terminfo db. Old clients will not work with a new server.
Diffstat (limited to 'usr.bin/tmux/server-client.c')
-rw-r--r--usr.bin/tmux/server-client.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 0a1245ccc93..cdfc95c3775 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.369 2021/02/11 08:28:45 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.370 2021/02/17 07:18:36 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -307,6 +307,7 @@ server_client_lost(struct client *c)
free(c->term_name);
free(c->term_type);
+ tty_term_free_list(c->term_caps, c->term_ncaps);
status_free(c);
@@ -1997,16 +1998,17 @@ server_client_dispatch(struct imsg *imsg, void *arg)
datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
switch (imsg->hdr.type) {
+ case MSG_IDENTIFY_CLIENTPID:
+ case MSG_IDENTIFY_CWD:
+ case MSG_IDENTIFY_ENVIRON:
case MSG_IDENTIFY_FEATURES:
case MSG_IDENTIFY_FLAGS:
case MSG_IDENTIFY_LONGFLAGS:
- case MSG_IDENTIFY_TERM:
- case MSG_IDENTIFY_TTYNAME:
- case MSG_IDENTIFY_CWD:
case MSG_IDENTIFY_STDIN:
case MSG_IDENTIFY_STDOUT:
- case MSG_IDENTIFY_ENVIRON:
- case MSG_IDENTIFY_CLIENTPID:
+ case MSG_IDENTIFY_TERM:
+ case MSG_IDENTIFY_TERMINFO:
+ case MSG_IDENTIFY_TTYNAME:
case MSG_IDENTIFY_DONE:
server_client_dispatch_identify(c, imsg);
break;
@@ -2200,6 +2202,14 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
c->term_name = xstrdup(data);
log_debug("client %p IDENTIFY_TERM %s", c, data);
break;
+ case MSG_IDENTIFY_TERMINFO:
+ if (datalen == 0 || data[datalen - 1] != '\0')
+ fatalx("bad MSG_IDENTIFY_TERMINFO string");
+ c->term_caps = xreallocarray(c->term_caps, c->term_ncaps + 1,
+ sizeof *c->term_caps);
+ c->term_caps[c->term_ncaps++] = xstrdup(data);
+ log_debug("client %p IDENTIFY_TERMINFO %s", c, data);
+ break;
case MSG_IDENTIFY_TTYNAME:
if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_TTYNAME string");