summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/server-client.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2012-05-06 07:38:17 +0000
committernicm <nicm@openbsd.org>2012-05-06 07:38:17 +0000
commit68dbe1fa781e3fcf0c246a9641d935851a52f294 (patch)
tree097a65865855c64184b7fa5475c990954ad807d7 /usr.bin/tmux/server-client.c
parentGarbage collect the old int$80 kernel entry point: the last use of (diff)
downloadwireguard-openbsd-68dbe1fa781e3fcf0c246a9641d935851a52f294.tar.xz
wireguard-openbsd-68dbe1fa781e3fcf0c246a9641d935851a52f294.zip
Add a helper function to open the terminal for attach-/new-session.
Diffstat (limited to 'usr.bin/tmux/server-client.c')
-rw-r--r--usr.bin/tmux/server-client.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 604a2255a31..a9c5a1c41c1 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.71 2012/04/11 06:16:14 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.72 2012/05/06 07:38:17 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -105,6 +105,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)