2018-02-25 08:13:54 +03:00
|
|
|
#include <string.h>
|
2018-05-02 13:25:03 +03:00
|
|
|
#include <stdlib.h>
|
2018-02-25 08:13:54 +03:00
|
|
|
|
|
|
|
extern char ** environ;
|
|
|
|
|
|
|
|
char * getenv(const char *name) {
|
|
|
|
char ** e = environ;
|
|
|
|
size_t len = strlen(name);
|
|
|
|
while (*e) {
|
|
|
|
char * t = *e;
|
|
|
|
if (strstr(t, name) == *e) {
|
|
|
|
if (t[len] == '=') {
|
|
|
|
return &t[len+1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
e++;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|