# 2.11BSD#431 - /usr/src/lib/libc/gen/getenv.c

##### Functions

    _findenv          X
    getenv            X

       1: /*
       2:  * Copyright (c) 1987 Regents of the University of California.
       3:  * This file may be freely redistributed provided that this
       4:  * notice remains attached.
       5:  */
       6:
       7: #if defined(LIBC_SCCS) && !defined(lint)
       8: static char sccsid[] = "@(#)getenv.c	5.4 (Berkeley) 3/13/87";
       9: #endif LIBC_SCCS and not lint
      10:
      11: #include <stdio.h>
      12:
      13: /*
      14:  * getenv(name) --
      15:  *	Returns ptr to value associated with name, if any, else NULL.
      16:  */
      17: char *
      18: getenv(name)
      19:     char *name;
      20: {
      21:     int offset;
      22:     char    *_findenv();
      23:
      24:     return(_findenv(name,&offset));
      25: }
      26:
      27: /*
      28:  * _findenv(name,offset) --
      29:  *	Returns pointer to value associated with name, if any, else NULL.
      30:  *	Sets offset to be the offset of the name/value combination in the
      31:  *	environmental array, for use by setenv(3) and unsetenv(3).
      32:  *	Explicitly removes '=' in argument name.
      33:  *
      34:  *	This routine *should* be a static; don't use it.
      35:  */
      36: char *
      37: _findenv(name,offset)
      38:     register char *name;
      39:     int *offset;
      40: {
      41:     extern char **environ;
      42:     register int    len;
      43:     register char   **P,
      44:             *C;
      45:
      46:     for (C = name,len = 0;*C && *C != '=';++C,++len);
      47:     for (P = environ;*P;++P)
      48:         if (!strncmp(*P,name,len))
      49:             if (*(C = *P + len) == '=') {
      50:                 *offset = P - environ;
      51:                 return(++C);
      52:             }
      53:     return(NULL);
      54: }

#### Defined functions

_findenv defined in line 36; used 5 times

- in line 22-24(2)
- in /usr/src/lib/libc/gen/setenv.c line 29-34(2), 86

getenv defined in line 17; used 353 times

- in /usr/include/stdlib.h line 78
- in /usr/src/bin/ar/extern.h line 46
- in /usr/src/bin/ar/misc.c line 64
- in /usr/src/bin/chpass/chpass.c line 402-404(2)
- in /usr/src/bin/csh/sh.c line 73, 83-90(3)
- in /usr/src/bin/csh/sh.dol.c line 397-401(2)
- in /usr/src/bin/csh/sh.h line 416
- in /usr/src/bin/disklabel/disklabel.c line 692
- in /usr/src/bin/mail.c line 226
- in /usr/src/bin/make/dosys.c line 35-36(2)
- in /usr/src/bin/mt.c line 57, 66
- in /usr/src/bin/tcsh/ed.screen.c line 1178, 1200, 1224, 1360-1370(3)
- in /usr/src/bin/tcsh/sh.c line 195, 205(2), 280, 297, 309, 323-325(3), 369, 378, 400
- in /usr/src/bin/tcsh/sh.dir.c line 116
- in /usr/src/bin/tcsh/sh.dol.c line 500-504(2)
- in /usr/src/bin/tcsh/sh.func.c line 1117-1118(2)
- in /usr/src/bin/tcsh/sh.set.c line 159
- in /usr/src/bin/tcsh/tc.func.c line 402, 410
- in /usr/src/bin/tcsh/tc.os.c line 81, 118
- in /usr/src/bin/tcsh/tc.os.h line 292
- in /usr/src/bin/tcsh/tc.prompt.c line 164, 170
- in /usr/src/bin/tcsh/tw.help.c line 99
- in /usr/src/bin/write.c line 227-228(2)
- in /usr/src/games/adventure/save.c line 97, 107
- in /usr/src/games/atc/input.c line 285, 291
- in /usr/src/games/backgammon/main.c line 106
- in /usr/src/games/backgammon/teach.c line 59
- in /usr/src/games/battlestar/save.c line 15, 22, 70, 77
- in /usr/src/games/canfield.c line 1273
- in /usr/src/games/hack/hack.main.c line 58, 88-90(2), 180(2), 211, 218
- in /usr/src/games/hack/hack.mklev.c line 124
- in /usr/src/games/hack/hack.mkshop.c line 24-25(2), 61
- in /usr/src/games/hack/hack.options.c line 11, 21
- in /usr/src/games/hack/hack.pager.c line 342, 379
- in /usr/src/games/hack/hack.termcap.c line 7, 31
- in /usr/src/games/hack/hack.u_init.c line 310-311(2)
- in /usr/src/games/hack/hack.unix.c line 27, 112, 288, 408
- in /usr/src/games/hunt/hunt.c line 146, 671
- in /usr/src/games/hunt/hunt.h line 299
- in /usr/src/games/monop/misc.c line 288, 296
- in /usr/src/games/rain.c line 43, 62
- in /usr/src/games/rogue/machdep.c line 424-426(2)
- in /usr/src/games/sail/dr_1.c line 380
- in /usr/src/games/sail/externs.h line 282
- in /usr/src/games/sail/pl_main.c line 169
- in /usr/src/games/snake/move.c line 526, 532
- in /usr/src/games/snake/snake.c line 887
- in /usr/src/games/warp/intrp.c line 77-79(2), 85-87(2)
- in /usr/src/games/warp/sig.c line 87
- in /usr/src/games/warp/term.c line 142
- in /usr/src/games/warp/util.c line 323
- in /usr/src/games/warp/warp.h line 326, 457
- in /usr/src/games/worm.c line 259
- in /usr/src/games/worms.c line 148, 202
- in /usr/src/lib/libc/compat-sys5/tmpnam.c line 57-62(2)
- in /usr/src/lib/libc/gen/ctime.c line 56, 262
- in /usr/src/lib/libc/gen/execvp.c line 13, 33
- in /usr/src/lib/libc/gen/timezone.c line 37
- in /usr/src/lib/libc/net/res_init.c line 63, 122
- in /usr/src/lib/libc/net/res_query.c line 222-226(2)
- in /usr/src/lib/libc/net/ruserpass.c line 143
- in /usr/src/local/afio/afio.c line 293, 2355
- in /usr/src/local/less/main.c line 251, 259, 267
- in /usr/src/local/less/screen.c line 178-183(2)
- in /usr/src/local/mtools/init.c line 247-252(2)
- in /usr/src/local/mtools/mcd.c line 30, 82
- in /usr/src/local/qterm/qterm.c line 329, 662, 866
- in /usr/src/local/welcome/welcome.c line 93
- in /usr/src/local/zmodem/rz.c line 269-274(2)
- in /usr/src/local/zmodem/sz.c line 97, 375-377(2)
- in /usr/src/new/OLD/apl/src/ai.c line 612, 623
- in /usr/src/new/OLD/apl/src/xed.c line 823, 4398
- in /usr/src/new/PORT/B/src/bint/b.h line 207
- in /usr/src/new/PORT/B/src/bint/b0fil.c line 31
- in /usr/src/new/PORT/B/src/bsmall/b.h line 165
- in /usr/src/new/PORT/B/src/bsmall/b2fil.c line 57-58(2)
- in /usr/src/new/PORT/apl/src/ai.c line 612, 623
- in /usr/src/new/PORT/apl/src/xed.c line 823
- in /usr/src/new/PORT/perl.1.0.0/arg.c line 1202, 1818-1820(2)
- in /usr/src/new/PORT/perl.1.0.10/arg.c line 1230, 1846-1848(2)
- in /usr/src/new/PORT/perl.1.0.16/arg.c line 1249, 1865-1867(2)
- in /usr/src/new/kermit5.188/ckcnet.c line 1230
- in /usr/src/new/kermit5.188/ckufio.c line 1155, 1253, 1398-1400(2), 1952, 2386, 2736, 2871, 2898
- in /usr/src/new/kermit5.188/ckustr.c line 64-65(2)
- in /usr/src/new/kermit5.188/ckutio.c line 4945-4947(2)
- in /usr/src/new/kermit5.188/ckuus4.c line 1100, 2704
- in /usr/src/new/kermit5.188/ckuus6.c line 604, 627
- in /usr/src/new/kermit5.188/ckuus7.c line 722
- in /usr/src/new/kermit5.188/ckuusr.c line 1868, 1968
- in /usr/src/new/kermit5.188/ckuusx.c line 436, 446-447(2), 455, 1850
- in /usr/src/new/nntp/common/clientlib.c line 65-68(2)
- in /usr/src/new/nntp/inews/inews.c line 208-212(2)
- in /usr/src/new/nntp/server/access_dnet.c line 38-43(3)
- in /usr/src/new/notes/src/checknotes.c line 111
- in /usr/src/new/notes/src/cursor.c line 142, 156
- in /usr/src/new/notes/src/help.c line 22
- in /usr/src/new/notes/src/mailit.c line 113
- in /usr/src/new/notes/src/main.c line 65-72(4), 177, 252
- in /usr/src/new/notes/src/structs.h line 408
- in /usr/src/new/notes/src/talkto.c line 32
- in /usr/src/new/rn/common.h line 698
- in /usr/src/new/rn/intrp.c line 96-98(2), 104-106(2)
- in /usr/src/new/rn/rcstuff.c line 70
- in /usr/src/new/rn/sw.c line 38, 154-155(2)
- in /usr/src/new/rn/term.c line 141
- in /usr/src/new/rn/util.c line 45, 507
- in /usr/src/old/cu/cu.c line 371-372(2)
- in /usr/src/old/prmail/prmail.c line 22, 36
- in /usr/src/ucb/Mail/def.h line 293
- in /usr/src/ucb/Mail/temp.c line 87
- in /usr/src/ucb/Mail/v7.local.c line 76
- in /usr/src/ucb/Mail/vars.c line 115
- in /usr/src/ucb/PORT/pascal/pdx/library.c line 194-197(2)
- in /usr/src/ucb/PORT/pascal/pdx/tree/misc.c line 24, 43
- in /usr/src/ucb/apply.c line 32, 125
- in /usr/src/ucb/clear.c line 26, 35
- in /usr/src/ucb/ex/ex.c line 295, 301-310(3)
- in /usr/src/ucb/ex/ex.h line 336
- in /usr/src/ucb/ex/ex_cmds.c line 211
- in /usr/src/ucb/ftp/cmds.c line 1231
- in /usr/src/ucb/ftp/ruserpass.c line 74
- in /usr/src/ucb/indent/args.c line 20, 116
- in /usr/src/ucb/man/apropos.c line 52, 78
- in /usr/src/ucb/man/man.c line 64, 107, 134-136(2)
- in /usr/src/ucb/more/more.c line 133, 1452, 1523
- in /usr/src/ucb/msgs/msgs.c line 359, 403
- in /usr/src/ucb/rlogin.c line 38, 128
- in /usr/src/ucb/sccs.c line 228, 251, 1511
- in /usr/src/ucb/script.c line 29, 55
- in /usr/src/ucb/telnet.c line 1296-1299(2)
- in /usr/src/ucb/tn3270/map3270.c line 785-789(2), 795
- in /usr/src/ucb/tn3270/mset.c line 110, 116
- in /usr/src/ucb/tset/tset.c line 643, 831
- in /usr/src/ucb/ul.c line 59-63(2), 359
- in /usr/src/ucb/vacation.c line 374-378(2)
- in /usr/src/ucb/vgrind/vgrindefs.c line 36
- in /usr/src/ucb/window/main.c line 91
- in /usr/src/ucb/window/startup.c line 23
- in /usr/src/ucb/window/wwinit.c line 61
- in /usr/src/usr.bin/at/at.c line 124, 378
- in /usr/src/usr.bin/learn/selsub.c line 20, 47
- in /usr/src/usr.bin/plot/crtplot.c line 34, 75
- in /usr/src/usr.bin/refer/refer..c line 48
- in /usr/src/usr.bin/refer/refer1.c line 80-81(2)
- in /usr/src/usr.bin/shar/shar.c line 126-128(3)
- in /usr/src/usr.bin/tabs.c line 66, 75
- in /usr/src/usr.bin/tip/remcap.c line 56, 70, 116
- in /usr/src/usr.bin/tip/remote.c line 144
- in /usr/src/usr.bin/tip/tip.c line 130
- in /usr/src/usr.bin/tip/tip.h line 240
- in /usr/src/usr.bin/tip/value.c line 30
- in /usr/src/usr.bin/uucp/getpwinfo.c line 25
- in /usr/src/usr.bin/uucp/uuxqt.c line 177
- in /usr/src/usr.lib/lib2648/ttyinit.c line 29
- in /usr/src/usr.lib/libI77/f77_abort.c line 18, 33
- in /usr/src/usr.lib/libI77/open.c line 28, 68
- in /usr/src/usr.lib/libU77/system_.c line 48, 58
- in /usr/src/usr.lib/libcurses/initscr.c line 14, 37
- in /usr/src/usr.lib/libplot/dumb/open.c line 34-37(2)
- in /usr/src/usr.lib/libtermlib/tc1.c line 18, 25
- in /usr/src/usr.lib/libtermlib/tc2.c line 19, 28
- in /usr/src/usr.lib/libtermlib/tc3.c line 18, 33
- in /usr/src/usr.lib/libtermlib/termcap.c line 35, 54
- in /usr/src/usr.sbin/catman/catman.c line 47
- in /usr/src/usr.sbin/chroot/chroot.c line 36, 49
- in /usr/src/usr.sbin/cron/crontab.c line 357-358(2)
- in /usr/src/usr.sbin/edquota/edquota.c line 313, 337
- in /usr/src/usr.sbin/lpr/lp.h line 90
- in /usr/src/usr.sbin/lpr/lpq.c line 103, 191
- in /usr/src/usr.sbin/lpr/lpr.c line 69, 206
- in /usr/src/usr.sbin/lpr/lprm.c line 93
- in /usr/src/usr.sbin/lpr/pac.c line 65, 130
- in /usr/src/usr.sbin/lpr/printcap.c line 53, 124, 134
- in /usr/src/usr.sbin/named/tools/nslookup/main.c line 1097
- in /usr/src/usr.sbin/named/tools/nslookup/res.h line 140
- in /usr/src/usr.sbin/sendmail.MX/src/envelope.c line 529
- in /usr/src/usr.sbin/sendmail.MX/src/main.c line 233
- in /usr/src/usr.sbin/sendmail/src/envelope.c line 524
- in /usr/src/usr.sbin/sendmail/src/main.c line 228
- in /usr/src/usr.sbin/vipw/vipw.c line 237

#### Defined variables

sccsid defined in line 8; never used

Last modified: 1987-03-31 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 683 |