1: /* @(#)getenv.c 2.1 SCCS id keyword */
2: /*
3: * getenv(name)
4: * returns ptr to value associated with name, if any, else NULL
5: */
6: #define NULL 0
7: extern char **environ;
8: char *nvmatch();
9:
10: char *
11: getenv(name)
12: register char *name;
13: {
14: register char **p = environ;
15: register char *v;
16:
17: while (*p != NULL)
18: if ((v = nvmatch(name, *p++)) != NULL)
19: return(v);
20: return(NULL);
21: }
22:
23: /*
24: * s1 is either name, or name=value
25: * s2 is name=value
26: * if names match, return value of s2, else NULL
27: * used for environment searching: see getenv
28: */
29:
30: static char *
31: nvmatch(s1, s2)
32: register char *s1, *s2;
33: {
34:
35: while (*s1 == *s2++)
36: if (*s1++ == '=')
37: return(s2);
38: if (*s1 == '\0' && *(s2-1) == '=')
39: return(s2);
40: return(NULL);
41: }
Defined functions
getenv
defined in line
10; used 105 times
- in /usr/src/cmd/at.c line
131,
171
- in /usr/src/cmd/cu.3451A.c line
504-505(2)
- in /usr/src/cmd/cu.c line
381-382(2)
- in /usr/src/cmd/ps/ps.c line
119,
134
- in /usr/src/cmd/su.c line
14,
94,
105
- in /usr/src/cmd/write.c line
32,
189-190(2)
- in /usr/src/games/snake/move.c line
516,
522
- in /usr/src/games/snake/snake.c line
868
- in /usr/src/lib/c/gen/execvp.c line
10,
30
- in /usr/src/lib/c/stdio/system.c line
6,
22
- in /usr/src/lib/curses/initscr.c line
4,
23
- in /usr/src/lib/libU77/system_.c line
41,
51
- in /usr/src/ucb/Mail/def.h line
275
- in /usr/src/ucb/Mail/v7.local.c line
56
- in /usr/src/ucb/Mail/vars.c line
83
- in /usr/src/ucb/clear.c line
10,
19
- in /usr/src/ucb/csh/sh.c line
59,
69-76(3)
- in /usr/src/ucb/csh/sh.dol.c line
384-388(2)
- in /usr/src/ucb/csh/sh.h line
399
- in /usr/src/ucb/delivermail/vax-mail.c line
47,
242
- in /usr/src/ucb/ex/ex2/ex.c line
249,
255-262(3)
- in /usr/src/ucb/ex/ex2/ex.h line
298
- in /usr/src/ucb/ex/ex2/ex_cmds.c line
189
- in /usr/src/ucb/ex/ex3/ex.c line
295,
301-310(3)
- in /usr/src/ucb/ex/ex3/ex.h line
344
- in /usr/src/ucb/ex/ex3/ex_cmds.c line
203
- in /usr/src/ucb/indent/indent.c line
1124
- in /usr/src/ucb/lpr/src/lpq.c line
61,
113
- in /usr/src/ucb/lpr/src/lpr.c line
59,
95
- in /usr/src/ucb/lpr/src/lprm.c line
52,
115
- in /usr/src/ucb/lpr/src/printcap.c line
44
- in /usr/src/ucb/more.c line
89,
118,
1372,
1422
- in /usr/src/ucb/msgs/msgs.c line
352,
381
- in /usr/src/ucb/mt.c line
43,
52
- in /usr/src/ucb/oldcsh/sh.c line
25,
67
- in /usr/src/ucb/oldcsh/sh.dol.c line
360-364(2)
- in /usr/src/ucb/oldcsh/sh.h line
367
- in /usr/src/ucb/prmail.c line
10,
24
- in /usr/src/ucb/script.c line
52,
112
- in /usr/src/ucb/sendmail/aux/vacation.c line
273
- in /usr/src/ucb/sendmail/include/useful.h line
58
- in /usr/src/ucb/sendmail/src/envelope.c line
660
- in /usr/src/ucb/sendmail/src/main.c line
140
- in /usr/src/ucb/sysline.c line
178,
316-319(2),
346,
1090,
1118
- in /usr/src/ucb/termlib/tc1.c line
8,
15
- in /usr/src/ucb/termlib/tc2.c line
9,
18
- in /usr/src/ucb/termlib/tc3.c line
8,
23
- in /usr/src/ucb/termlib/termcap.c line
26,
47,
57
- in /usr/src/ucb/tset/tset.c line
489,
843-848(2),
1156
- in /usr/src/ucb/ul.c line
18,
29
- in /usr/src/ucb/vgrind/vgrindefs.c line
27
- in /usr/src/ucb/vsh/curses.c line
11
- in /usr/src/ucb/vsh/main.c line
51-53(2)
Defined macros
NULL
defined in line
6; used 4 times