1 #include <stdlib.h>
2 #include <string.h>
3 #include "libc.h"
4 
getenv(const char * name)5 char *getenv(const char *name)
6 {
7 	int i;
8 	size_t l = strlen(name);
9 	if (!__environ || !*name || strchr(name, '=')) return NULL;
10 	for (i=0; __environ[i] && (strncmp(name, __environ[i], l)
11 		|| __environ[i][l] != '='); i++);
12 	if (__environ[i]) return __environ[i] + l+1;
13 	return NULL;
14 }
15