From bafc17a6b92c7daeefc7b9b936007a1d0c9876b2 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 15 Jul 2016 09:28:32 +0000 Subject: [PATCH] Log environment to new panes. --- usr.bin/tmux/environ.c | 12 +++++++++++- usr.bin/tmux/tmux.h | 3 ++- usr.bin/tmux/window.c | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/usr.bin/tmux/environ.c b/usr.bin/tmux/environ.c index c4ccd10104a..a1e66c95d77 100644 --- a/usr.bin/tmux/environ.c +++ b/usr.bin/tmux/environ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: environ.c,v 1.13 2016/05/26 12:15:42 nicm Exp $ */ +/* $OpenBSD: environ.c,v 1.14 2016/07/15 09:28:32 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -203,3 +203,13 @@ environ_push(struct environ *env) setenv(envent->name, envent->value, 1); } } + +/* Log the environment. */ +void +environ_log(struct environ *env) +{ + struct environ_entry *envent; + + RB_FOREACH(envent, environ, env) + log_debug("%s=%s", envent->name, envent->value); +} diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 5be2a16b33a..cecf1eedf9c 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.638 2016/07/15 00:49:08 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.639 2016/07/15 09:28:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1693,6 +1693,7 @@ void environ_put(struct environ *, const char *); void environ_unset(struct environ *, const char *); void environ_update(const char *, struct environ *, struct environ *); void environ_push(struct environ *); +void environ_log(struct environ *); /* tty.c */ void tty_create_log(void); diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index a248ced1d7d..fb2e85bb104 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.163 2016/06/16 10:55:47 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.164 2016/07/15 09:28:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -842,6 +842,7 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv, log_debug("spawn: %s -- %s", wp->shell, cmd); for (i = 0; i < wp->argc; i++) log_debug("spawn: argv[%d] = %s", i, wp->argv[i]); + environ_log(env); memset(&ws, 0, sizeof ws); ws.ws_col = screen_size_x(&wp->base); -- 2.20.1