diff options
Diffstat (limited to 'libc/stdlib/getenv.c')
-rw-r--r-- | libc/stdlib/getenv.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/libc/stdlib/getenv.c b/libc/stdlib/getenv.c index 1ed83a622..b5d4de9aa 100644 --- a/libc/stdlib/getenv.c +++ b/libc/stdlib/getenv.c @@ -6,26 +6,22 @@ #include <stdlib.h> #include <malloc.h> -extern char ** environ; +extern char **environ; -char * -getenv(var) -const char * var; +char *getenv(var) +const char *var; { - char **p; - int len; + char **p; + int len; - len = strlen(var); - - if (!environ) - return 0; - - for(p=environ; *p; p++) - { - if( memcmp(var, *p, len) == 0 && (*p)[len] == '=' ) - return *p + len + 1; - } - return 0; -} + len = strlen(var); + if (!environ) + return 0; + for (p = environ; *p; p++) { + if (memcmp(var, *p, len) == 0 && (*p)[len] == '=') + return *p + len + 1; + } + return 0; +} |