summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-new-session.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-10-28 09:51:56 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-10-28 09:51:56 +0000
commit40292bea5af2e23c6bb1c93a31f83cbe49759bd2 (patch)
treea194b8cd92e6aa597a927b77a6bb9827b12d8e05 /usr.bin/tmux/cmd-new-session.c
parent56b0f7fb77db41cfb361986b6cb66954d779c413 (diff)
Like options, move the environ struct into environ.c.
Diffstat (limited to 'usr.bin/tmux/cmd-new-session.c')
-rw-r--r--usr.bin/tmux/cmd-new-session.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c
index 33bdea996d7..9b194cc8e2a 100644
--- a/usr.bin/tmux/cmd-new-session.c
+++ b/usr.bin/tmux/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-new-session.c,v 1.74 2015/10/27 15:58:42 nicm Exp $ */
+/* $OpenBSD: cmd-new-session.c,v 1.75 2015/10/28 09:51:55 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -60,7 +60,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
struct client *c = cmdq->client, *c0;
struct session *s, *groupwith;
struct window *w;
- struct environ env;
+ struct environ *env;
struct termios tio, *tiop;
const char *newname, *target, *update, *errstr, *template;
const char *path;
@@ -223,30 +223,30 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
path = NULL;
if (c != NULL && c->session == NULL)
- envent = environ_find(&c->environ, "PATH");
+ envent = environ_find(c->environ, "PATH");
else
- envent = environ_find(&global_environ, "PATH");
+ envent = environ_find(global_environ, "PATH");
if (envent != NULL)
path = envent->value;
/* Construct the environment. */
- environ_init(&env);
+ env = environ_create();
if (c != NULL && !args_has(args, 'E')) {
update = options_get_string(global_s_options,
"update-environment");
- environ_update(update, &c->environ, &env);
+ environ_update(update, c->environ, env);
}
/* Create the new session. */
idx = -1 - options_get_number(global_s_options, "base-index");
- s = session_create(newname, argc, argv, path, cwd, &env, tiop, idx, sx,
+ s = session_create(newname, argc, argv, path, cwd, env, tiop, idx, sx,
sy, &cause);
+ environ_free(env);
if (s == NULL) {
cmdq_error(cmdq, "create session failed: %s", cause);
free(cause);
goto error;
}
- environ_free(&env);
/* Set the initial window name if one given. */
if (argc >= 0 && args_has(args, 'n')) {