File:  [MW Coherent from dump] / coherent / b / lib / libc / gen / getenv.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:35 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent



/*
 * search environment for name
 * An environmental parameter is a string of the form "name=value".
 * A pointer to the value is returned if the supplied argument matches the
 * name, otherwise 0.  The value is not a copy, so alterations will be
 * reflected in the environment.  Bogus parameters are ignored.
 */
char	*
getenv( name)
char	*name;
{
	register char	*p,
			*q,
			**ep;
	extern char	**environ;

	ep = environ;
	if (ep == ((char **)0))
		return (((char *)0));

	while (p = *ep++) {
		for (q=name; *q==*p++; ++q)
			if (*q == '\0')
				break;
		if (*q=='\0' && p[-1]=='=')
			return (p);
	}

	return (((char *)0));
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.