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 implementation of atexit and printf
[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 *str;
16
int len;
17
18
if(!_envp) return NULL;
19
if(!name) return NULL;
20
21
22
len = strlen((char*)name);
23
24
env = _envp;
25
while(*env) {
26
str = *env;
27
if(str[len] == '=' && strncmp((char*)name, str, len) == 0) {
28
return str+len+1;
29
}
30
env ++;
31
}
32
33
return NULL;
34
}
UCC
git Repository :: git.ucc.asn.au