summaryrefslogtreecommitdiff
path: root/src/basic/env-util.h
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2016-08-04 12:00:00 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-20 18:49:14 -0500
commit37f3ffca273e5238794019caede7b7cd33a5de3a (patch)
treee33c5556d5cb2dd89064d8c3344b904fd8853f47 /src/basic/env-util.h
parentd8ad241f54b8c4ac76aafd960d89b47b0ed87fb6 (diff)
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/env-util.h')
-rw-r--r--src/basic/env-util.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/basic/env-util.h b/src/basic/env-util.h
index 90df5b1cd9..4e83dcb43a 100644
--- a/src/basic/env-util.h
+++ b/src/basic/env-util.h
@@ -29,7 +29,11 @@ bool env_name_is_valid(const char *e);
bool env_value_is_valid(const char *e);
bool env_assignment_is_valid(const char *e);
-char *replace_env(const char *format, char **env);
+enum {
+ REPLACE_ENV_USE_ENVIRONMENT = 1u,
+};
+
+char *replace_env(const char *format, char **env, unsigned flags);
char **replace_env_argv(char **argv, char **env);
bool strv_env_is_valid(char **e);
@@ -47,7 +51,7 @@ char **strv_env_unset(char **l, const char *p); /* In place ... */
char **strv_env_unset_many(char **l, ...) _sentinel_;
int strv_env_replace(char ***l, char *p); /* In place ... */
-char *strv_env_get_n(char **l, const char *name, size_t k) _pure_;
+char *strv_env_get_n(char **l, const char *name, size_t k, unsigned flags) _pure_;
char *strv_env_get(char **x, const char *n) _pure_;
int getenv_bool(const char *p);