overhaul internally-public declarations using wrapper headers
[musl] / src / env / getenv.c
1 #include <stdlib.h>
2 #include <string.h>
3 #include <unistd.h>
4 #include "libc.h"
5
6 char *getenv(const char *name)
7 {
8         size_t l = __strchrnul(name, '=') - name;
9         if (l && !name[l] && __environ)
10                 for (char **e = __environ; *e; e++)
11                         if (!strncmp(name, *e, l) && l[*e] == '=')
12                                 return *e + l+1;
13         return 0;
14 }