From 8386d11b3e41316540b3001f5180200caf2b504b Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 15 Jul 2016 09:52:34 +0000 Subject: [PATCH] Tweak output of environment logging. --- usr.bin/tmux/environ.c | 12 ++++++++---- usr.bin/tmux/tmux.h | 4 ++-- usr.bin/tmux/window.c | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/usr.bin/tmux/environ.c b/usr.bin/tmux/environ.c index a1e66c95d77..c184dd1d51f 100644 --- a/usr.bin/tmux/environ.c +++ b/usr.bin/tmux/environ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: environ.c,v 1.14 2016/07/15 09:28:32 nicm Exp $ */ +/* $OpenBSD: environ.c,v 1.15 2016/07/15 09:52:34 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -206,10 +206,14 @@ environ_push(struct environ *env) /* Log the environment. */ void -environ_log(struct environ *env) +environ_log(struct environ *env, const char *prefix) { struct environ_entry *envent; - RB_FOREACH(envent, environ, env) - log_debug("%s=%s", envent->name, envent->value); + RB_FOREACH(envent, environ, env) { + if (envent->value != NULL && *envent->name != '\0') { + log_debug("%s%s=%s", prefix, envent->name, + envent->value); + } + } } diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index cecf1eedf9c..c80771b36d1 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.639 2016/07/15 09:28:32 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.640 2016/07/15 09:52:34 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1693,7 +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 *); +void environ_log(struct environ *, const char *); /* tty.c */ void tty_create_log(void); diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index fb2e85bb104..b1e11df2b53 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.164 2016/07/15 09:28:32 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.165 2016/07/15 09:52:34 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -842,7 +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); + environ_log(env, "spawn: "); memset(&ws, 0, sizeof ws); ws.ws_col = screen_size_x(&wp->base); -- 2.20.1