|
|
1.1 ! root 1: ! 2: ! 3: /* ! 4: * search environment for name ! 5: * An environmental parameter is a string of the form "name=value". ! 6: * A pointer to the value is returned if the supplied argument matches the ! 7: * name, otherwise 0. The value is not a copy, so alterations will be ! 8: * reflected in the environment. Bogus parameters are ignored. ! 9: */ ! 10: char * ! 11: getenv( name) ! 12: char *name; ! 13: { ! 14: register char *p, ! 15: *q, ! 16: **ep; ! 17: extern char **environ; ! 18: ! 19: ep = environ; ! 20: if (ep == ((char **)0)) ! 21: return (((char *)0)); ! 22: ! 23: while (p = *ep++) { ! 24: for (q=name; *q==*p++; ++q) ! 25: if (*q == '\0') ! 26: break; ! 27: if (*q=='\0' && p[-1]=='=') ! 28: return (p); ! 29: } ! 30: ! 31: return (((char *)0)); ! 32: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.