summaryrefslogtreecommitdiffstats
path: root/cmd-split-window.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2019-04-28 23:02:30 +0100
committerThomas Adam <thomas@xteddy.org>2019-04-28 23:02:30 +0100
commit3ab229da706bc8cffadfa500708937c1e3e84145 (patch)
treefdd4c60ba6addc019b8d249c5deb3d5d14f92591 /cmd-split-window.c
parent2cecabd75ecb19e46c221c76f642807869ae63e6 (diff)
parentc4b0da5513ee4c9692f0980408b0da2ee7e3a553 (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-split-window.c')
-rw-r--r--cmd-split-window.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/cmd-split-window.c b/cmd-split-window.c
index e9da1f3e..b06c48f2 100644
--- a/cmd-split-window.c
+++ b/cmd-split-window.c
@@ -39,8 +39,8 @@ const struct cmd_entry cmd_split_window_entry = {
.name = "split-window",
.alias = "splitw",
- .args = { "bc:dfF:l:hp:Pt:v", 0, -1 },
- .usage = "[-bdfhvP] [-c start-directory] [-F format] "
+ .args = { "bc:de:fF:l:hp:Pt:v", 0, -1 },
+ .usage = "[-bdefhvP] [-c start-directory] [-e environment] [-F format] "
"[-p percentage|-l size] " CMD_TARGET_PANE_USAGE " [command]",
.target = { 't', CMD_FIND_PANE, 0 },
@@ -63,8 +63,9 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
struct layout_cell *lc;
struct cmd_find_state fs;
int size, percentage, flags;
- const char *template;
+ const char *template, *add;
char *cause, *cp;
+ struct args_value *value;
if (args_has(args, 'h'))
type = LAYOUT_LEFTRIGHT;
@@ -116,6 +117,13 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
sc.name = NULL;
sc.argc = args->argc;
sc.argv = args->argv;
+ sc.environ = environ_create();
+
+ add = args_first_value(args, 'e', &value);
+ while (add != NULL) {
+ environ_put(sc.environ, add);
+ add = args_next_value(&value);
+ }
sc.idx = -1;
sc.cwd = args_get(args, 'c');
@@ -145,5 +153,6 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
cmd_find_from_winlink_pane(&fs, wl, new_wp, 0);
cmdq_insert_hook(s, item, &fs, "after-split-window");
+ environ_free(sc.environ);
return (CMD_RETURN_NORMAL);
}