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: getenv.c,v 1.4 91/04/24 12:18:03 ceriel Exp $ */ 6: 7: #include <stdlib.h> 8: 9: extern const char ***_penviron; 10: 11: char * 12: getenv(const char *name) 13: { 14: register const char **v = *_penviron; 15: register const char *p, *q; 16: 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; 26: } 27: return (char *)NULL; 28: }