You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
343 B
26 lines
343 B
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
/*
|
|
* Simple getenv. Linus
|
|
*/
|
|
|
|
extern char ** environ;
|
|
|
|
char * getenv(const char * name)
|
|
{
|
|
int len;
|
|
char * tmp;
|
|
char ** env;
|
|
|
|
len = strlen(name);
|
|
if (env=environ)
|
|
while (tmp=*(env++)) {
|
|
if (strncmp(name,tmp,len))
|
|
continue;
|
|
if (tmp[len]=='=')
|
|
return tmp+len+1;
|
|
}
|
|
return NULL;
|
|
}
|