]> git.saurik.com Git - apple/libc.git/blame - man/FreeBSD/environ.7
Libc-1439.100.3.tar.gz
[apple/libc.git] / man / FreeBSD / environ.7
CommitLineData
224c7076
A
1.\" Copyright (c) 1983, 1990, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
974e3884 12.\" 3. Neither the name of the University nor the names of its contributors
224c7076
A
13.\" may be used to endorse or promote products derived from this software
14.\" without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\" @(#)environ.7 8.3 (Berkeley) 4/19/94
974e3884 29.\" $FreeBSD$
224c7076 30.\"
974e3884 31.Dd April 12, 2003
224c7076 32.Dt ENVIRON 7
974e3884 33.Os
224c7076
A
34.Sh NAME
35.Nm environ
36.Nd user environment
37.Sh SYNOPSIS
38.Ar extern char **environ ;
39.Sh DESCRIPTION
40An array of strings called the
41.Ar environment
42is made available by
974e3884
A
43.Xr execve 2
44when a process begins.
45By convention these strings have the form
224c7076
A
46.Dq Ar name=value .
47The following names are used by various commands:
974e3884 48.Bl -tag -width LC_MONETARY
224c7076
A
49.It Ev BLOCKSIZE
50The size of the block units used by several commands, most notably
51.Xr df 1 ,
52.Xr du 1
53and
54.Xr ls 1 .
974e3884
A
55This variable is processed by the
56.Xr getbsize 3
57function.
58.It Ev COLUMNS
59The user's preferred width in column positions for the terminal.
60Utilities such as
61.Xr ls 1
62and
63.Xr who 1
64use this to format output into columns.
65If unset or empty, utilities will use an
66.Xr ioctl 2
67call to ask the terminal driver for the width.
68.It Ev EDITOR
69Default editor name.
224c7076
A
70.It Ev EXINIT
71A startup list of commands read by
974e3884 72.Xr ex 1
224c7076 73and
974e3884 74.Xr vi 1 .
224c7076
A
75.It Ev HOME
76A user's login directory, set by
974e3884 77.Xr login 1
224c7076 78from the password file
974e3884
A
79.Xr passwd 5 .
80.It Ev LANG
81This variable configures all programs which use
82.Xr setlocale 3
83to use the specified locale unless the
84.Ev LC_*
85variables are set.
86.It Ev LC_ALL
87Overrides the values of
88.Ev LC_COLLATE ,
89.Ev LC_CTYPE ,
90.Ev LC_MESSAGES ,
91.Ev LC_MONETARY ,
92.Ev LC_NUMERIC ,
93.Ev LC_TIME
94and
95.Ev LANG .
96.It Ev LC_COLLATE
97Locale to be used for ordering of strings.
98.It Ev LC_CTYPE
99Locale to be used for character classification
100(letter, space, digit, etc.) and for interpreting byte sequences as
101multibyte characters.
102.It Ev LC_MESSAGES
103Locale to be used for diagnostic messages.
104.It Ev LC_MONETARY
105Locale to be used for interpreting monetary input
106and formatting output.
107.It Ev LC_NUMERIC
108Locale to be used for interpreting numeric input and
109formatting output.
110.It Ev LC_TIME
111Locale to be used for interpreting dates input and
112for formatting output.
113.It Ev MAIL
114The location of the user's
115mailbox instead of the default in /var/mail,
116used by
117.Xr mail 1 ,
118.Xr sh 1 ,
119and many other mail clients.
120.It Ev NLSPATH
121List of directories to be searched for the message catalog referred to by
122.Ev LC_MESSAGES .
123See
124.Xr catopen 3 .
125.It Ev PAGER
126Default paginator program.
127The program specified by this variable is used by
128.Xr mail 1 ,
129.Xr man 1 ,
130.Xr ftp 1 ,
131etc, to display information which is longer than the current display.
224c7076
A
132.It Ev PATH
133The sequence of directories, separated by colons, searched by
974e3884
A
134.Xr csh 1 ,
135.Xr sh 1 ,
136.Xr system 3 ,
137.Xr execvp 3 ,
224c7076 138etc, when looking for an executable file.
974e3884
A
139.Ev PATH
140is set to ``/usr/bin:/bin'' initially by
141.Xr login 1 .
224c7076
A
142.It Ev PRINTER
143The name of the default printer to be used by
974e3884
A
144.Xr lpr 1 ,
145.Xr lpq 1 ,
224c7076 146and
974e3884
A
147.Xr lprm 1 .
148.It Ev PWD
149The current directory pathname.
224c7076
A
150.It Ev SHELL
151The full pathname of the user's login shell.
152.It Ev TERM
153The kind of terminal for which output is to be prepared.
154This information is used by commands, such as
974e3884
A
155.Xr nroff 1
156or
157.Xr plot 1
158which may exploit special terminal capabilities.
159See
160.Pa /usr/share/misc/termcap
161.Pq Xr termcap 5
162for a list of terminal types.
163.It Ev TERMCAP
164The string describing the terminal in
165.Ev TERM ,
166or, if
167it begins with a '/', the name of the termcap file.
168See
169.Ev TERMPATH
170below, and
171.Xr termcap 5 .
172.It Ev TERMPATH
173A sequence of pathnames of termcap files, separated by colons or spaces,
174which are searched for terminal descriptions in the order listed.
175Having
176no
177.Ev TERMPATH
178is equivalent to a
179.Ev TERMPATH
180of
181.Dq Pa $HOME/.termcap:/etc/termcap .
182.Ev TERMPATH
183is ignored if
184.Ev TERMCAP
185contains a full pathname.
224c7076
A
186.It Ev TMPDIR
187The directory in which to store temporary files.
188Most applications use either
189.Dq /tmp
190or
191.Dq /var/tmp .
192Setting this variable will make them use another directory.
193.It Ev TZ
194The timezone to use when displaying dates.
195The normal format is a pathname relative to
974e3884 196.Dq Pa /usr/share/zoneinfo .
224c7076 197For example, the command
974e3884 198.Dq env TZ=America/Los_Angeles date
224c7076
A
199displays the current time in California.
200See
201.Xr tzset 3
202for more information.
224c7076 203.It Ev USER
974e3884 204The login name of the user.
224c7076
A
205.El
206.Pp
207Further names may be placed in the environment by the
974e3884 208.Ic export
224c7076
A
209command and
210.Ar name=value
211arguments in
974e3884 212.Xr sh 1 ,
224c7076 213or by the
974e3884 214.Ic setenv
224c7076 215command if you use
974e3884 216.Xr csh 1 .
224c7076 217It is unwise to change certain
974e3884 218.Xr sh 1
224c7076
A
219variables that are frequently exported by
220.Pa .profile
221files, such as
222.Ev MAIL ,
223.Ev PS1 ,
224.Ev PS2 ,
225and
226.Ev IFS ,
227unless you know what you are doing.
974e3884
A
228.Pp
229The current environment variables can be printed with
230.Xr env 1 ,
231.Xr set 1
232or
233.Xr printenv 1
234in
235.Xr sh 1
236and
237.Xr env 1 ,
238.Xr printenv 1
239or the
240.Cm printenv
241built-in command in
242.Xr csh 1 .
224c7076
A
243.Sh PROGRAMMING
244Programs can query and modify the environment, using the environment routines
245.Xr getenv 3 ,
246.Xr putenv 3 ,
247.Xr setenv 3
248and
249.Xr unsetenv 3 .
250Direct access can be made through the global variable
251.Va environ ,
252though it is recommended that changes to the enviroment still be made through
253the environment routines.
254.Pp
255Shared libraries and bundles don't have direct access to
256.Va environ ,
257which is only available to the loader
258.Xr ld 1
259when a complete program is being linked.
260The environment routines can still be used, but if direct access to
261.Va environ
262is needed, the
263.Fn _NSGetEnviron
264routine, defined in
265.In crt_externs.h ,
266can be used to retrieve the address of
267.Va environ
268at runtime.
269.Sh SEE ALSO
974e3884 270.Xr cd 1 ,
224c7076 271.Xr csh 1 ,
974e3884 272.Xr env 1 ,
224c7076
A
273.Xr ex 1 ,
274.Xr login 1 ,
974e3884 275.Xr printenv 1 ,
224c7076 276.Xr sh 1 ,
974e3884
A
277.Xr execve 2 ,
278.Xr execle 3 ,
224c7076
A
279.Xr getenv 3 ,
280.Xr putenv 3 ,
281.Xr setenv 3 ,
282.Xr unsetenv 3 ,
974e3884 283.Xr setlocale 3 ,
224c7076
A
284.Xr system 3 ,
285.Xr termcap 3 ,
974e3884 286.Xr termcap 5
224c7076
A
287.Sh HISTORY
288The
974e3884 289.Nm
224c7076
A
290manual page appeared in
291.Bx 4.2 .