mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
slave: unsetenv() env vars that have been set to the empty string
That is, users can now *clear* environment variables by doing: [environment] VAR=”” Note that the quotes are required. Closes #1225
This commit is contained in:
parent
646314469a
commit
ccfb953bb0
3 changed files with 24 additions and 13 deletions
11
slave.c
11
slave.c
|
|
@ -359,8 +359,15 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
|
|||
#endif
|
||||
|
||||
if (extra_env_vars != NULL) {
|
||||
tll_foreach(*extra_env_vars, it)
|
||||
setenv(it->item.name, it->item.value, 1);
|
||||
tll_foreach(*extra_env_vars, it) {
|
||||
const char *name = it->item.name;
|
||||
const char *value = it->item.value;
|
||||
|
||||
if (strlen(value) == 0)
|
||||
unsetenv(name);
|
||||
else
|
||||
setenv(name, value, 1);
|
||||
}
|
||||
}
|
||||
|
||||
char **_shell_argv = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue