Annotation of 43BSDTahoe/man/man3/getenv.3, revision 1.1.1.1

1.1       root        1: .\"    @(#)getenv.3    6.4 (Berkeley) 3/20/87
                      2: .\"
                      3: .TH GETENV 3 "March 20, 1987"
                      4: .AT 3
                      5: .SH NAME
                      6: getenv, setenv, unsetenv \- manipulate environmental variables
                      7: .SH SYNOPSIS
                      8: .nf
                      9: .B char *getenv(name)
                     10: .B char *name;
                     11: .PP
                     12: .B setenv(name, value, overwrite)
                     13: .B char *name, value;
                     14: .B int overwrite;
                     15: .PP
                     16: .B void unsetenv(name)
                     17: .B char *name;
                     18: .fi
                     19: .SH DESCRIPTION
                     20: \fIGetenv\fP searches the environment list (see \fIenviron\fP(7))
                     21: for a string of the form \fIname\fP\fB=\fP\fIvalue\fP and returns
                     22: a pointer to the string \fIvalue\fP if such a string is present,
                     23: and 0 (NULL) if it is not.
                     24: .PP
                     25: \fISetenv\fP searches the environment list as \fIgetenv\fP does; if
                     26: the string \fIname\fP is not found, a string of the form
                     27: \fIname\fP\fB=\fP\fIvalue\fP is added to the environment.  If it is
                     28: found, and \fIoverwrite\fP is non-zero, its value is changed to
                     29: \fIvalue\fP.  \fISetenv\fP returns 0 on success and -1 on failure,
                     30: where failure is caused by an inability to allocate space for the
                     31: environment.
                     32: .PP
                     33: \fIUnsetenv\fP removes all occurrences of the string \fIname\fP from
                     34: the environment.  There is no library provision for completely removing
                     35: the current environment.  It is suggested that the following code be
                     36: used to do so.
                     37: .PP
                     38: .nf
                     39:        static char     *envinit[1];
                     40:        extern char     **environ;
                     41:        environ = envinit;
                     42: .fi
                     43: .PP
                     44: All of these routines permit, but do not require, a trailing equals
                     45: (``='') sign on \fIname\fP or a leading equals sign on \fIvalue\fP.
                     46: .SH SEE ALSO
                     47: csh(1), sh(1), execve(2), environ(7)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.