diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-02-09 23:06:54 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-02-09 23:06:54 +0000 |
commit | e57fc6bbb2e98f9ef3336db698dc7dd260dfc502 (patch) | |
tree | d525aa4fb8a13d6459c6339e4543c840b415e636 /libc/stdlib/getenv.c | |
parent | 56139d5a7109db33a7f3e951595a45a0f7f12cd4 (diff) |
Use __environ instead of the GNU extension environ.
-Erik
Diffstat (limited to 'libc/stdlib/getenv.c')
-rw-r--r-- | libc/stdlib/getenv.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libc/stdlib/getenv.c b/libc/stdlib/getenv.c index b5d4de9aa..ca50402b9 100644 --- a/libc/stdlib/getenv.c +++ b/libc/stdlib/getenv.c @@ -4,10 +4,9 @@ */ #include <string.h> #include <stdlib.h> +#include <unistd.h> #include <malloc.h> -extern char **environ; - char *getenv(var) const char *var; { @@ -16,10 +15,10 @@ const char *var; len = strlen(var); - if (!environ) + if (!__environ) return 0; - for (p = environ; *p; p++) { + for (p = __environ; *p; p++) { if (memcmp(var, *p, len) == 0 && (*p)[len] == '=') return *p + len + 1; } |