mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Make environ_log prefix take a format.
This commit is contained in:
parent
c54a5b3690
commit
349cdd6110
10
environ.c
10
environ.c
@ -208,9 +208,15 @@ environ_push(struct environ *env)
|
|||||||
|
|
||||||
/* Log the environment. */
|
/* Log the environment. */
|
||||||
void
|
void
|
||||||
environ_log(struct environ *env, const char *prefix)
|
environ_log(struct environ *env, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
struct environ_entry *envent;
|
struct environ_entry *envent;
|
||||||
|
va_list ap;
|
||||||
|
char *prefix;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vasprintf(&prefix, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
RB_FOREACH(envent, environ, env) {
|
RB_FOREACH(envent, environ, env) {
|
||||||
if (envent->value != NULL && *envent->name != '\0') {
|
if (envent->value != NULL && *envent->name != '\0') {
|
||||||
@ -218,6 +224,8 @@ environ_log(struct environ *env, const char *prefix)
|
|||||||
envent->value);
|
envent->value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create initial environment for new child. */
|
/* Create initial environment for new child. */
|
||||||
|
2
tmux.h
2
tmux.h
@ -1621,7 +1621,7 @@ void environ_put(struct environ *, const char *);
|
|||||||
void environ_unset(struct environ *, const char *);
|
void environ_unset(struct environ *, const char *);
|
||||||
void environ_update(struct options *, struct environ *, struct environ *);
|
void environ_update(struct options *, struct environ *, struct environ *);
|
||||||
void environ_push(struct environ *);
|
void environ_push(struct environ *);
|
||||||
void environ_log(struct environ *, const char *);
|
void printflike(2, 3) environ_log(struct environ *, const char *, ...);
|
||||||
struct environ *environ_for_session(struct session *, int);
|
struct environ *environ_for_session(struct session *, int);
|
||||||
|
|
||||||
/* tty.c */
|
/* tty.c */
|
||||||
|
Loading…
Reference in New Issue
Block a user