]> git.saurik.com Git - apple/libc.git/blame - man/environ.7
Libc-1082.50.1.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
6465356a 67.Xr ex 1
224c7076
A
68and
69.Xr vi 1 .
70.It Ev HOME
71A user's login directory, set by
72.Xr login 1
73from the password file
74.Xr passwd 5 .
75.It Ev PATH
76The sequence of directories, separated by colons, searched by
77.Xr csh 1 ,
78.Xr sh 1 ,
79.Xr system 3 ,
80.Xr execvp 3 ,
81etc, when looking for an executable file.
82PATH is set to ``/usr/bin:/bin'' initially by
83.Xr login 1 .
84.It Ev PRINTER
85The name of the default printer to be used by
86.Xr lpr 1 ,
87.Xr lpq 1 ,
88and
89.Xr lprm 1 .
90.It Ev SHELL
91The full pathname of the user's login shell.
92.It Ev TERM
93The kind of terminal for which output is to be prepared.
94This information is used by commands, such as
95.Xr nroff 1
224c7076 96which may exploit special terminal capabilities. See
6465356a 97.Xr termcap 3
224c7076 98and
6465356a 99.Xr terminfo 5 .
224c7076
A
100.It Ev TMPDIR
101The directory in which to store temporary files.
102Most applications use either
103.Dq /tmp
104or
105.Dq /var/tmp .
106Setting this variable will make them use another directory.
107.It Ev TZ
108The timezone to use when displaying dates.
109The normal format is a pathname relative to
110.Dq /usr/share/zoneinfo .
111For example, the command
112.Dq env TZ=US/Pacific date
113displays the current time in California.
114See
115.Xr tzset 3
116for more information.
117.It Ev LOGNAME
118The login name of the user.
119.It Ev USER
120Deprecated synonym of
121.Ev LOGNAME
122(for backwards compatibility).
123.El
124.Pp
125Further names may be placed in the environment by the
126.Xr export
127command and
128.Ar name=value
129arguments in
130.Xr sh 1 ,
131or by the
132.Xr setenv
133command if you use
134.Xr csh 1 .
135It is unwise to change certain
136.Xr sh 1
137variables that are frequently exported by
138.Pa .profile
139files, such as
140.Ev MAIL ,
141.Ev PS1 ,
142.Ev PS2 ,
143and
144.Ev IFS ,
145unless you know what you are doing.
146.Sh PROGRAMMING
147Programs can query and modify the environment, using the environment routines
148.Xr getenv 3 ,
149.Xr putenv 3 ,
150.Xr setenv 3
151and
152.Xr unsetenv 3 .
153Direct access can be made through the global variable
154.Va environ ,
155though it is recommended that changes to the enviroment still be made through
156the environment routines.
157.Pp
158Shared libraries and bundles don't have direct access to
159.Va environ ,
160which is only available to the loader
161.Xr ld 1
162when a complete program is being linked.
163The environment routines can still be used, but if direct access to
164.Va environ
165is needed, the
166.Fn _NSGetEnviron
167routine, defined in
168.In crt_externs.h ,
169can be used to retrieve the address of
170.Va environ
171at runtime.
172.Sh SEE ALSO
173.Xr csh 1 ,
174.Xr ex 1 ,
175.Xr login 1 ,
176.Xr sh 1 ,
177.Xr getenv 3 ,
178.Xr putenv 3 ,
179.Xr setenv 3 ,
180.Xr unsetenv 3 ,
181.Xr execve 2 ,
182.Xr execle 3 ,
183.Xr system 3 ,
184.Xr termcap 3 ,
6465356a 185.Xr terminfo 5
224c7076
A
186.Sh HISTORY
187The
188.Nm environ
189manual page appeared in
190.Bx 4.2 .