aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2012-05-12 15:00:19 +0000
committerTiago Cunha <tcunha@gmx.com>2012-05-12 15:00:19 +0000
commit1340c012b05695fea9e2ee9d07b477c7d8150129 (patch)
tree00f7fb1e4442dbe47b7a67a4a791a9b287f92e32 /server-client.c
parent2f0db58777e2293d0aa6d96c1d59660b541ee2db (diff)
downloadrtmux-1340c012b05695fea9e2ee9d07b477c7d8150129.tar.gz
rtmux-1340c012b05695fea9e2ee9d07b477c7d8150129.tar.bz2
rtmux-1340c012b05695fea9e2ee9d07b477c7d8150129.zip
Sync OpenBSD patchset 1111:
Add a helper function to open the terminal for attach-/new-session.
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/server-client.c b/server-client.c
index 44a5e13f..6e2484e0 100644
--- a/server-client.c
+++ b/server-client.c
@@ -104,6 +104,25 @@ server_client_create(int fd)
log_debug("new client %d", fd);
}
+/* Open client terminal if needed. */
+int
+server_client_open(struct client *c, struct session *s, char **cause)
+{
+ struct options *oo = s != NULL ? &s->options : &global_s_options;
+ char *overrides;
+
+ if (!(c->flags & CLIENT_TERMINAL)) {
+ *cause = xstrdup ("not a terminal");
+ return (-1);
+ }
+
+ overrides = options_get_string(oo, "terminal-overrides");
+ if (tty_open(&c->tty, overrides, cause) != 0)
+ return (-1);
+
+ return (0);
+}
+
/* Lost a client. */
void
server_client_lost(struct client *c)