shithub: scc

ref: 7d06d1d348ce9fb9dc585d81f146e12193be85e4
dir: /src/libc/arch/posix/getenv.c/

View raw version
#include <stdlib.h>
#include <string.h>

#undef getenv

extern const char **_environ;

char *
getenv(const char *name)
{
	const char **p, *s;
	size_t len = strlen(name);

	for (p = _environ; s = *p; ++p) {
		if (!strncmp(name, s, len) && s[len] == '=')
			return (char *) s + len + 1;
	}
	return NULL;
}