aboutsummaryrefslogtreecommitdiff
path: root/server-msg.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-08-08 21:52:43 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-08-08 21:52:43 +0000
commit6491274f60c175b89b02b6e4cd0c59b13717e2ec (patch)
tree615959fa3459ad20491f0fedcfcce5a2940d0186 /server-msg.c
parente9856294408c76f374547d9e74d4292f1b0c1163 (diff)
downloadrtmux-6491274f60c175b89b02b6e4cd0c59b13717e2ec.tar.gz
rtmux-6491274f60c175b89b02b6e4cd0c59b13717e2ec.tar.bz2
rtmux-6491274f60c175b89b02b6e4cd0c59b13717e2ec.zip
Infrastructure and commands to manage the environment for processes started
within tmux. There is a global environment, copied from the external environment when the server is started and each sesssion has an (initially empty) session environment which overrides it. New commands set-environment and show-environment manipulate or display the environments. A new session option, update-environment, is a space-separated list of variables which are updated from the external environment into the session environment every time a new session is created - the default is DISPLAY.
Diffstat (limited to 'server-msg.c')
-rw-r--r--server-msg.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/server-msg.c b/server-msg.c
index 2ee357ed..b23ec4c4 100644
--- a/server-msg.c
+++ b/server-msg.c
@@ -42,6 +42,7 @@ server_msg_dispatch(struct client *c)
struct msg_identify_data identifydata;
struct msg_resize_data resizedata;
struct msg_unlock_data unlockdata;
+ struct msg_environ_data environdata;
for (;;) {
if (BUFFER_USED(c->in) < sizeof hdr)
@@ -100,6 +101,15 @@ server_msg_dispatch(struct client *c)
tty_start_tty(&c->tty);
server_redraw_client(c);
break;
+ case MSG_ENVIRON:
+ if (hdr.size != sizeof environdata)
+ fatalx("bad MSG_ENVIRON size");
+ buffer_read(c->in, &environdata, sizeof environdata);
+
+ environdata.var[(sizeof environdata.var) - 1] = '\0';
+ if (strchr(environdata.var, '=') != NULL)
+ environ_put(&c->environ, environdata.var);
+ break;
default:
fatalx("unexpected message");
}