git.ucc.asn.au
/
tpg
/
acess2.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Usermode/libc - Fixed DIV0 in fread/fopen
[tpg/acess2.git]
/
Usermode
/
Libraries
/
libc.so_src
/
env.c
1
/*
2
* Acess C Library
3
* - Environment Handler
4
*/
5
#include <stdlib.h>
6
#include <string.h>
7
8
// === GLOBALS ===
9
char **_envp = NULL;
10
11
// === CODE ===
12
char *getenv(const char *name)
13
{
14
char **env;
15
char *env_str;
16
int len;
17
18
if(!_envp) return NULL;
19
if(!name) return NULL;
20
21
len = strlen((char*)name);
22
23
env = _envp;
24
while(*env)
25
{
26
env_str = *env;
27
if(strncmp(name, env_str, len) == 0 && env_str[len] == '=') {
28
return env_str+len+1;
29
}
30
env ++;
31
}
32
33
return NULL;
34
}
UCC
git Repository :: git.ucc.asn.au