diff options
author | Ray Strode <rstrode@redhat.com> | 2016-08-04 12:00:00 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-20 18:49:14 -0500 |
commit | 37f3ffca273e5238794019caede7b7cd33a5de3a (patch) | |
tree | e33c5556d5cb2dd89064d8c3344b904fd8853f47 /src/basic/fileio.h | |
parent | basic: drop unnecessary strempty() call in replace_env (diff) | |
download | systemd-37f3ffca273e5238794019caede7b7cd33a5de3a.tar.gz systemd-37f3ffca273e5238794019caede7b7cd33a5de3a.tar.bz2 systemd-37f3ffca273e5238794019caede7b7cd33a5de3a.zip |
basic: add new merge_env_file function
merge_env_file is a new function, that's like load_env_file, but takes a
pre-existing environment as an input argument. New environment entries are
merged. Variable expansion is performed.
Falling back to the process environment is supported (when a flag is set).
Alternatively this could be implemented as passing an additional fallback
environment array, but later on we're adding another flag to allow braceless
expansion, and the two flags can be combined in one arg, so there's less
stuff to pass around.
Diffstat (limited to 'src/basic/fileio.h')
-rw-r--r-- | src/basic/fileio.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/basic/fileio.h b/src/basic/fileio.h index 64852b15a..e547614cc 100644 --- a/src/basic/fileio.h +++ b/src/basic/fileio.h @@ -48,6 +48,8 @@ int parse_env_file(const char *fname, const char *separator, ...) _sentinel_; int load_env_file(FILE *f, const char *fname, const char *separator, char ***l); int load_env_file_pairs(FILE *f, const char *fname, const char *separator, char ***l); +int merge_env_file(char ***env, FILE *f, const char *fname); + int write_env_file(const char *fname, char **l); int executable_is_script(const char *path, char **interpreter); |