mirror of https://git.musl-libc.org/git/musl
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
344 B
15 lines
344 B
|
15 years ago
|
#include <stdlib.h>
|
||
|
|
#include <string.h>
|
||
|
|
#include "libc.h"
|
||
|
|
|
||
|
|
char *getenv(const char *name)
|
||
|
|
{
|
||
|
|
int i;
|
||
|
|
size_t l = strlen(name);
|
||
|
|
if (!__environ || !*name || strchr(name, '=')) return NULL;
|
||
|
|
for (i=0; __environ[i] && (strncmp(name, __environ[i], l)
|
||
|
|
|| __environ[i][l] != '='); i++);
|
||
|
|
if (__environ[i]) return __environ[i] + l+1;
|
||
|
|
return NULL;
|
||
|
|
}
|