/* Search the environment for a variable. Return the value, if found, or NULL, if not found.  */
char* fw_getenv(char *name)
/* Search the environment for a variable. Return the value, if found, or NULL, if not found.  */
char* fw_getenv(char *name)
{
	char *env, *nxt;
	for (env = environment.data; *env; env = nxt + 1) {
		char *val;
		for (nxt = env; *nxt; ++nxt) {
			if (nxt >= &environment.data[ENV_SIZE]) {
				fprintf(stderr, "## Error: "
					"environment not terminated\n");
				return NULL;
			}
		}
		val = envmatch(name, env);
		if (!val)
			continue;
		return val;
	}
	return NULL;
}