diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-01-06 20:38:02 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-01-06 20:38:02 +0100 |
commit | a6ff950e71ea665fff99740f7b3e0137d451a79e (patch) | |
tree | 502ff29d4c0d410285e54666571b1831061e6af0 /src/test-env-replace.c | |
parent | 7fc942b29e7bdb9d6aa3123f53da6680edabd8f0 (diff) |
execute: drop empty assignments from env blocks on execution but keep them around otherwise to make them visible
Diffstat (limited to 'src/test-env-replace.c')
-rw-r--r-- | src/test-env-replace.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/test-env-replace.c b/src/test-env-replace.c index 37dd7ff590..4188c67dde 100644 --- a/src/test-env-replace.c +++ b/src/test-env-replace.c @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) { NULL }; - char **i, **r, *t; + char **i, **r, *t, **a, **b; r = replace_env_argv((char**) line, (char**) env); @@ -96,5 +96,24 @@ int main(int argc, char *argv[]) { printf("%s\n", t); free(t); + a = strv_new("FOO=BAR", "WALDO=WALDO", "WALDO=", "PIEP", "SCHLUMPF=SMURF", NULL); + b = strv_new("FOO=KKK", "FOO=", "PIEP=", "SCHLUMPF=SMURFF", "NANANANA=YES", NULL); + + r = strv_env_merge(2, a, b); + strv_free(a); + strv_free(b); + + STRV_FOREACH(i, r) + printf("%s\n", *i); + + printf("CLEANED UP:\n"); + + r = strv_env_clean(r); + + STRV_FOREACH(i, r) + printf("%s\n", *i); + + strv_free(r); + return 0; } |