diff options
author | Thomas Adam <thomas@xteddy.org> | 2019-04-28 23:02:30 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2019-04-28 23:02:30 +0100 |
commit | 3ab229da706bc8cffadfa500708937c1e3e84145 (patch) | |
tree | fdd4c60ba6addc019b8d249c5deb3d5d14f92591 /cmd-new-window.c | |
parent | 2cecabd75ecb19e46c221c76f642807869ae63e6 (diff) | |
parent | c4b0da5513ee4c9692f0980408b0da2ee7e3a553 (diff) | |
download | rtmux-3ab229da706bc8cffadfa500708937c1e3e84145.tar.gz rtmux-3ab229da706bc8cffadfa500708937c1e3e84145.tar.bz2 rtmux-3ab229da706bc8cffadfa500708937c1e3e84145.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-new-window.c')
-rw-r--r-- | cmd-new-window.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/cmd-new-window.c b/cmd-new-window.c index 1007c597..6cb33dd9 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -38,9 +38,9 @@ const struct cmd_entry cmd_new_window_entry = { .name = "new-window", .alias = "neww", - .args = { "ac:dF:kn:Pt:", 0, -1 }, - .usage = "[-adkP] [-c start-directory] [-F format] [-n window-name] " - CMD_TARGET_WINDOW_USAGE " [command]", + .args = { "ac:de:F:kn:Pt:", 0, -1 }, + .usage = "[-adkP] [-c start-directory] [-e environment] [-F format] " + "[-n window-name] " CMD_TARGET_WINDOW_USAGE " [command]", .target = { 't', CMD_FIND_WINDOW, CMD_FIND_WINDOW_INDEX }, @@ -60,8 +60,9 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item) int idx = item->target.idx; struct winlink *new_wl; char *cause = NULL, *cp; - const char *template; + const char *template, *add; struct cmd_find_state fs; + struct args_value *value; if (args_has(args, 'a') && (idx = winlink_shuffle_up(s, wl)) == -1) { cmdq_error(item, "couldn't get a window index"); @@ -75,6 +76,13 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item) sc.name = args_get(args, 'n'); 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 = idx; sc.cwd = args_get(args, 'c'); @@ -107,5 +115,6 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item) cmd_find_from_winlink(&fs, new_wl, 0); cmdq_insert_hook(s, item, &fs, "after-new-window"); + environ_free(sc.environ); return (CMD_RETURN_NORMAL); } |