source:
EcnlProtoTool/trunk/musl-1.1.18/src/env/getenv.c@
445
Last change on this file since 445 was 444, checked in by , 4 years ago | |
---|---|
|
|
File size: 325 bytes |
Line | |
---|---|
1 | #include <stdlib.h> |
2 | #include <string.h> |
3 | #include "libc.h" |
4 | |
5 | char *__strchrnul(const char *, int); |
6 | |
7 | char *getenv(const char *name) |
8 | { |
9 | size_t l = __strchrnul(name, '=') - name; |
10 | if (l && !name[l] && __environ) |
11 | for (char **e = __environ; *e; e++) |
12 | if (!strncmp(name, *e, l) && l[*e] == '=') |
13 | return *e + l+1; |
14 | return 0; |
15 | } |
Note:
See TracBrowser
for help on using the repository browser.