DataMuseum.dk

Presents historical artifacts from the history of:

Commodore CBM-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Commodore CBM-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦3fd3dbf92⟧ TextFile

    Length: 633 (0x279)
    Types: TextFile
    Notes: UNIX file
    Names: »getenv.c«

Derivation

└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
    └─⟦f4b8d8c84⟧ UNIX V7 Filesystem
        └─ ⟦this⟧ »libc/gen/getenv.c« 

TextFile



/*
 * 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));
}