]> git.saurik.com Git - apple/libc.git/blame - man/environ.7
Libc-825.24.tar.gz
[apple/libc.git] / man / environ.7
CommitLineData
224c7076
A
1.\" $NetBSD: environ.7,v 1.4 1995/07/03 19:45:07 jtc Exp $
2.\"
3.\" Copyright (c) 1983, 1990, 1993
4.\" The Regents of the University of California. All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\" must display the following acknowledgement:
16.\" This product includes software developed by the University of
17.\" California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\" may be used to endorse or promote products derived from this software
20.\" without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\" @(#)environ.7 8.3 (Berkeley) 4/19/94
35.\"
36.Dd April 19, 1994
37.Dt ENVIRON 7
38.Os BSD 4.2
39.Sh NAME
40.Nm environ
41.Nd user environment
42.Sh SYNOPSIS
43.Ar extern char **environ ;
44.Sh DESCRIPTION
45An array of strings called the
46.Ar environment
47is made available by
48.Xr execve 2
49when a process begins. By convention these strings have the form
50.Dq Ar name=value .
51The following names are used by various commands:
52.Bl -tag -width BLOCKSIZE
53.It Ev BLOCKSIZE
54The size of the block units used by several commands, most notably
55.Xr df 1 ,
56.Xr du 1
57and
58.Xr ls 1 .
59BLOCKSIZE may be specified in units of a byte by specifying a number,
60in units of a kilobyte by specifying a number followed by ``K'' or
61``k'', in units of a megabyte by specifying a number followed by ``M''
62or ``m'' and in units of a gigabyte by specifying a number followed
63by ``G'' or ``g''.
64Sizes less than 512 bytes or greater than a gigabyte are ignored.
65.It Ev EXINIT
66A startup list of commands read by
67.Xr ex 1 ,
68.Xr edit 1 ,
69and
70.Xr vi 1 .
71.It Ev HOME
72A user's login directory, set by
73.Xr login 1
74from the password file
75.Xr passwd 5 .
76.It Ev PATH
77The sequence of directories, separated by colons, searched by
78.Xr csh 1 ,
79.Xr sh 1 ,
80.Xr system 3 ,
81.Xr execvp 3 ,
82etc, when looking for an executable file.
83PATH is set to ``/usr/bin:/bin'' initially by
84.Xr login 1 .
85.It Ev PRINTER
86The name of the default printer to be used by
87.Xr lpr 1 ,
88.Xr lpq 1 ,
89and
90.Xr lprm 1 .
91.It Ev SHELL
92The full pathname of the user's login shell.
93.It Ev TERM
94The kind of terminal for which output is to be prepared.
95This information is used by commands, such as
96.Xr nroff 1
97or
98.Xr plot 1
99which may exploit special terminal capabilities. See
100.Pa /usr/share/misc/termcap
101.Pq Xr termcap 5
102for a list of terminal types.
103.It Ev TERMCAP
104The string describing the terminal in TERM, or, if
105it begins with a '/', the name of the termcap file.
106See
107.Ev TERMPATH
108below,
109.Xr termcap 5 ,
110and
111.Xr termcap .
112.It Ev TERMPATH
113A sequence of pathnames of termcap files, separated by colons or spaces,
114which are searched for terminal descriptions in the order listed. Having
115no
116.Ev TERMPATH
117is equivalent to a
118.Ev TERMPATH
119of
120.Dq Pa $HOME/.termcap:/etc/termcap .
121.Ev TERMPATH
122is ignored if
123.Ev TERMCAP
124contains a full pathname.
125.It Ev TMPDIR
126The directory in which to store temporary files.
127Most applications use either
128.Dq /tmp
129or
130.Dq /var/tmp .
131Setting this variable will make them use another directory.
132.It Ev TZ
133The timezone to use when displaying dates.
134The normal format is a pathname relative to
135.Dq /usr/share/zoneinfo .
136For example, the command
137.Dq env TZ=US/Pacific date
138displays the current time in California.
139See
140.Xr tzset 3
141for more information.
142.It Ev LOGNAME
143The login name of the user.
144.It Ev USER
145Deprecated synonym of
146.Ev LOGNAME
147(for backwards compatibility).
148.El
149.Pp
150Further names may be placed in the environment by the
151.Xr export
152command and
153.Ar name=value
154arguments in
155.Xr sh 1 ,
156or by the
157.Xr setenv
158command if you use
159.Xr csh 1 .
160It is unwise to change certain
161.Xr sh 1
162variables that are frequently exported by
163.Pa .profile
164files, such as
165.Ev MAIL ,
166.Ev PS1 ,
167.Ev PS2 ,
168and
169.Ev IFS ,
170unless you know what you are doing.
171.Sh PROGRAMMING
172Programs can query and modify the environment, using the environment routines
173.Xr getenv 3 ,
174.Xr putenv 3 ,
175.Xr setenv 3
176and
177.Xr unsetenv 3 .
178Direct access can be made through the global variable
179.Va environ ,
180though it is recommended that changes to the enviroment still be made through
181the environment routines.
182.Pp
183Shared libraries and bundles don't have direct access to
184.Va environ ,
185which is only available to the loader
186.Xr ld 1
187when a complete program is being linked.
188The environment routines can still be used, but if direct access to
189.Va environ
190is needed, the
191.Fn _NSGetEnviron
192routine, defined in
193.In crt_externs.h ,
194can be used to retrieve the address of
195.Va environ
196at runtime.
197.Sh SEE ALSO
198.Xr csh 1 ,
199.Xr ex 1 ,
200.Xr login 1 ,
201.Xr sh 1 ,
202.Xr getenv 3 ,
203.Xr putenv 3 ,
204.Xr setenv 3 ,
205.Xr unsetenv 3 ,
206.Xr execve 2 ,
207.Xr execle 3 ,
208.Xr system 3 ,
209.Xr termcap 3 ,
210.Xr termcap 5
211.Sh HISTORY
212The
213.Nm environ
214manual page appeared in
215.Bx 4.2 .