chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
move code to its own files
[elogind.git]
/
klibc
/
klibc
/
getenv.c
1
/*
2
* getenv.c
3
*/
4
5
#include <stdlib.h>
6
#include <string.h>
7
#include <unistd.h>
8
9
char *getenv(const char *name)
10
{
11
char **p, *q;
12
int len = strlen(name);
13
14
for ( p = environ ; (q = *p) ; p++ ) {
15
if ( !strncmp(name, q, len) && q[len] == '=' ) {
16
return q+(len+1);
17
}
18
}
19
20
return NULL;
21
}
22