Line | |
---|
1 | /*
|
---|
2 | * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
---|
3 | * See the copyright notice in the ACK home directory, in the file "Copyright".
|
---|
4 | */
|
---|
5 | /* $Header: /cvsup/minix/src/lib/ansi/getenv.c,v 1.1.1.1 2005/04/21 14:56:05 beng Exp $ */
|
---|
6 |
|
---|
7 | #include <stdlib.h>
|
---|
8 |
|
---|
9 | extern const char ***_penviron;
|
---|
10 |
|
---|
11 | char *
|
---|
12 | getenv(const char *name)
|
---|
13 | {
|
---|
14 | register const char **v = *_penviron;
|
---|
15 | register const char *p, *q;
|
---|
16 |
|
---|
17 | if (v == NULL || name == NULL)
|
---|
18 | return (char *)NULL;
|
---|
19 | while ((p = *v++) != NULL) {
|
---|
20 | q = name;
|
---|
21 | while (*q && (*q == *p++))
|
---|
22 | q++;
|
---|
23 | if (*q || (*p != '='))
|
---|
24 | continue;
|
---|
25 | return (char *)p + 1;
|
---|
26 | }
|
---|
27 | return (char *)NULL;
|
---|
28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.