diff options
Diffstat (limited to 'src/strv.c')
-rw-r--r-- | src/strv.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/strv.c b/src/strv.c index a66369602b..9dbab2937c 100644 --- a/src/strv.c +++ b/src/strv.c @@ -539,3 +539,20 @@ fail: return NULL; } + +char *strv_env_get_with_length(char **l, const char *name, size_t k) { + char **i; + + assert(name); + + STRV_FOREACH(i, l) + if (strncmp(*i, name, k) == 0 && + (*i)[k] == '=') + return *i + k + 1; + + return NULL; +} + +char *strv_env_get(char **l, const char *name) { + return strv_env_get_with_length(l, name, strlen(name)); +} |