mirror of
https://github.com/tmux/tmux.git
synced 2024-12-24 18:38:48 +00:00
Don't stop at first match when updating environment.
This commit is contained in:
parent
e139f977b1
commit
cfdc5b62ad
17
environ.c
17
environ.c
@ -182,9 +182,11 @@ void
|
||||
environ_update(struct options *oo, struct environ *src, struct environ *dst)
|
||||
{
|
||||
struct environ_entry *envent;
|
||||
struct environ_entry *envent1;
|
||||
struct options_entry *o;
|
||||
struct options_array_item *a;
|
||||
union options_value *ov;
|
||||
int found;
|
||||
|
||||
o = options_get(oo, "update-environment");
|
||||
if (o == NULL)
|
||||
@ -192,14 +194,15 @@ environ_update(struct options *oo, struct environ *src, struct environ *dst)
|
||||
a = options_array_first(o);
|
||||
while (a != NULL) {
|
||||
ov = options_array_item_value(a);
|
||||
RB_FOREACH(envent, environ, src) {
|
||||
if (fnmatch(ov->string, envent->name, 0) == 0)
|
||||
break;
|
||||
}
|
||||
if (envent == NULL)
|
||||
environ_clear(dst, ov->string);
|
||||
else
|
||||
found = 0;
|
||||
RB_FOREACH_SAFE(envent, environ, src, envent1) {
|
||||
if (fnmatch(ov->string, envent->name, 0) == 0) {
|
||||
environ_set(dst, envent->name, 0, "%s", envent->value);
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
environ_clear(dst, ov->string);
|
||||
a = options_array_next(a);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user