Uninitialized vector entry?
[minix3.git] / lib / ansi / getenv.c
blob6ec5e0fc2b064e43f7fef682ef6e1354efc68616
1 /*
2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
4 */
5 /* $Header$ */
7 #include <stdlib.h>
9 extern const char ***_penviron;
11 char *
12 getenv(const char *name)
14 register const char **v = *_penviron;
15 register const char *p, *q;
17 if (v == NULL || name == NULL)
18 return (char *)NULL;
19 while ((p = *v++) != NULL) {
20 q = name;
21 while (*q && (*q == *p++))
22 q++;
23 if (*q || (*p != '='))
24 continue;
25 return (char *)p + 1;
27 return (char *)NULL;