diff options
Diffstat (limited to 'usr.bin/tmux/server-fn.c')
-rw-r--r-- | usr.bin/tmux/server-fn.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c index 761d137d518..85be4a4ddfe 100644 --- a/usr.bin/tmux/server-fn.c +++ b/usr.bin/tmux/server-fn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-fn.c,v 1.12 2009/08/07 15:39:10 nicm Exp $ */ +/* $OpenBSD: server-fn.c,v 1.13 2009/08/08 21:52:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -26,25 +26,20 @@ int server_lock_callback(void *, const char *); -const char ** -server_fill_environ(struct session *s) +void +server_fill_environ(struct session *s, struct environ *env) { - static const char *env[] = { NULL /* TMUX= */, NULL /* TERM */, NULL }; - static char tmuxvar[MAXPATHLEN + 256], termvar[256]; - u_int idx; + char tmuxvar[MAXPATHLEN], *term; + u_int idx; if (session_index(s, &idx) != 0) fatalx("session not found"); - xsnprintf(tmuxvar, sizeof tmuxvar, - "TMUX=%s,%ld,%u", socket_path, (long) getpid(), idx); - env[0] = tmuxvar; - - xsnprintf(termvar, sizeof termvar, - "TERM=%s", options_get_string(&s->options, "default-terminal")); - env[1] = termvar; + "%s,%ld,%u", socket_path, (long) getpid(), idx); + environ_set(env, "TMUX", tmuxvar); - return (env); + term = options_get_string(&s->options, "default-terminal"); + environ_set(env, "TERM", term); } void |