1 --- getenv.c.bsdnew 2009-11-13 15:14:36.000000000 -0800
2 +++ getenv.c 2009-11-13 15:14:50.000000000 -0800
3 @@ -36,8 +36,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
7 +#include <crt_externs.h>
9 -inline char *__findenv(const char *, int *);
10 +__private_extern__ char *__findenv(const char *, int *, char **);
14 @@ -48,12 +49,12 @@ inline char *__findenv(const char *, int
16 * This routine *should* be a static; don't use it.
19 -__findenv(name, offset)
20 +__private_extern__ char *
21 +__findenv(name, offset, environ)
26 - extern char **environ;
30 @@ -76,6 +77,19 @@ __findenv(name, offset)
34 + * _getenvp -- SPI using an arbitrary pointer to string array (the array must
35 + * have been created with malloc) and an env state, created by _allocenvstate().
36 + * Returns ptr to value associated with name, if any, else NULL.
39 +_getenvp(const char *name, char ***envp, void *state __unused)
43 + return (__findenv(name, &offset, *envp));
48 * Returns ptr to value associated with name, if any, else NULL.
50 @@ -85,5 +99,5 @@ getenv(name)
54 - return (__findenv(name, &offset));
55 + return (__findenv(name, &offset, *_NSGetEnviron()));