summaryrefslogtreecommitdiff
path: root/src/basic/env-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/env-util.c')
-rw-r--r--src/basic/env-util.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/basic/env-util.c b/src/basic/env-util.c
index 4804a67f91..9ddac5d6a1 100644
--- a/src/basic/env-util.c
+++ b/src/basic/env-util.c
@@ -22,11 +22,14 @@
#include <limits.h>
#include <unistd.h>
+#include "alloc-util.h"
+#include "def.h"
+#include "env-util.h"
+#include "parse-util.h"
+#include "string-util.h"
#include "strv.h"
#include "utf8.h"
#include "util.h"
-#include "env-util.h"
-#include "def.h"
#define VALID_CHARS_ENV_NAME \
DIGITS LETTERS \
@@ -541,7 +544,7 @@ char **replace_env_argv(char **argv, char **env) {
STRV_FOREACH(i, argv) {
/* If $FOO appears as single word, replace it by the split up variable */
- if ((*i)[0] == '$' && (*i)[1] != '{') {
+ if ((*i)[0] == '$' && (*i)[1] != '{' && (*i)[1] != '$') {
char *e;
char **w, **m = NULL;
unsigned q;
@@ -592,3 +595,13 @@ char **replace_env_argv(char **argv, char **env) {
ret[k] = NULL;
return ret;
}
+
+int getenv_bool(const char *p) {
+ const char *e;
+
+ e = getenv(p);
+ if (!e)
+ return -ENXIO;
+
+ return parse_boolean(e);
+}