blob: edf5c4f90a00739a730a52b9c4473610c38eadfc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include <stdlib.h>
#include "string.h"
/** get an environment variable **/
char * getenv(const char * name)
{
extern char **environ;
int i = 0;
while (environ[i] != 0) {
if (!strncmp(environ[i], name, strlen(name)) && environ[i][strlen(name)] == '=')
return environ[i];
i++;
}
return NULL;
}
/***
read the environment variable ARGUMENT(name) from the host environment.
***/
/*
UNDEFINED(Modifying the returned string)
IMPLEMENTATION(The set of environment variable names)
IMPLEMENTATION(The method of altering the environment)
RETURN_FAILURE(CONSTANT(NULL))
RETURN_SUCCESS(a pointer to the environment string)
STDC(1)
*/
|