Files
codezero/conts/posix/libposix/env.c
Bahadir Balban 7ba7a2e796 Added a simplified ascii_to_int() implementation.
Removed dependency on hard-coded pager id. Pager id is now passed
as an environment string `pagerid' to tasks. Alternatively, this
could take space in the utcb of each task.
2009-10-17 18:48:30 +03:00

37 lines
573 B
C

/*
* Environment accessor functions
*
* Copyright (C) 2008 Bahadir Balban
*/
#include <string.h>
#include <stdlib.h>
#include <libposix.h>
char **__environ;
/*
* Search for given name in name=value string pairs located
* in the environment segment, and return the pointer to value
* string.
*/
char *getenv(const char *name)
{
char **envp = __environ;
int length;
if (!envp)
return 0;
length = strlen(name);
while(*envp) {
if (memcmp(name, *envp, length) == 0 &&
(*envp)[length] == '=')
return *envp + length + 1;
envp++;
}
return 0;
}