diff options
author | 2009-08-08 21:52:43 +0000 | |
---|---|---|
committer | 2009-08-08 21:52:43 +0000 | |
commit | 6f7d62ebc9d2569213457966b9dab344dd30c124 (patch) | |
tree | db1575bc7a8f723d64cf32fa11b69f42b628e4dd /usr.bin/tmux/cmd-split-window.c | |
parent | Tidy function a little by using a temporary variable. (diff) | |
download | wireguard-openbsd-6f7d62ebc9d2569213457966b9dab344dd30c124.tar.xz wireguard-openbsd-6f7d62ebc9d2569213457966b9dab344dd30c124.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 'usr.bin/tmux/cmd-split-window.c')
-rw-r--r-- | usr.bin/tmux/cmd-split-window.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd-split-window.c b/usr.bin/tmux/cmd-split-window.c index 2585b1f15d4..4907af86deb 100644 --- a/usr.bin/tmux/cmd-split-window.c +++ b/usr.bin/tmux/cmd-split-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-split-window.c,v 1.7 2009/07/26 12:58:44 nicm Exp $ */ +/* $OpenBSD: cmd-split-window.c,v 1.8 2009/08/08 21:52:43 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -149,7 +149,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) struct winlink *wl; struct window *w; struct window_pane *wp; - const char **env; + struct environ env; char *cmd, *cwd, *cause; u_int hlimit; int size; @@ -159,7 +159,10 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) return (-1); w = wl->window; - env = server_fill_environ(s); + environ_init(&env); + environ_copy(&global_environ, &env); + environ_copy(&s->environ, &env); + server_fill_environ(s, &env); cmd = data->cmd; if (cmd == NULL) @@ -181,7 +184,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) type = LAYOUT_LEFTRIGHT; wp = window_add_pane(w, hlimit); - if (window_pane_spawn(wp, cmd, cwd, env, &cause) != 0) + if (window_pane_spawn(wp, cmd, cwd, &env, &cause) != 0) goto error; if (layout_split_pane(w->active, type, size, wp) != 0) { cause = xstrdup("pane too small"); @@ -197,9 +200,11 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) } else server_status_session(s); + environ_free(&env); return (0); error: + environ_free(&env); if (wp != NULL) window_remove_pane(w, wp); ctx->error(ctx, "create pane failed: %s", cause); |