Penguin
Annotated edit history of environ(7) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 ENVIRON
2 !!!ENVIRON
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 BUGS
7 SEE ALSO
8 ----
9 !!NAME
10
11
12 environ - user environment
13 !!SYNOPSIS
14
15
16 __extern char **environ;
17 __
18 !!DESCRIPTION
19
20
21 The variable ''environ'' points to an array of strings
22 called the `environment'. (This variable must be declared in
23 the user program, but is declared in the header file
24 ''unistd.h'' in case the header files came from libc4 or
25 libc5, and in case they came from glibc and
26 ___GNU_SOURCE__ was defined.) This array of strings is
27 made available to the process by the exec(3) call
28 that started the process. By convention these strings have
29 the form `''name''__=__''value'''. Common examples
30 are:
31
32
33 __USER__
34
35
36 The name of the logged-in user (used by some BSD-derived
37 programs).
38
39
40 __LOGNAME__
41
42
43 The name of the logged-in user (used by some System-V
44 derived programs).
45
46
47 __HOME__
48
49
50 A user's login directory, set by login(1) from the
51 password file passwd(5).
52
53
54 __LANG__
55
56
57 The name of a locale to use for locale categories when not
58 overridden by __LC_ALL__ or more specific environment
59 variables like __LC_COLLATE__, __LC_CTYPE__,
60 __LC_MESSAGES__, __LC_MONETARY__, __LC_NUMERIC__,
61 __LC_TIME__, cf. locale(5).
62
63
64 __PATH__
65
66
67 The sequence of directory prefixes that sh(1) and
68 many other programs apply in searching for a file known by
69 an incomplete path name. The prefixes are separated by
70 `__:__'. (Similarly one has __CDPATH__ used by some
71 shells to find the target of a change directory command,
72 __MANPATH__ used by man(1) to find manual pages,
73 etc.)
74
75
76 __PWD__
77
78
79 The current working directory. Set by some
80 shells.
81
82
83 __SHELL__
84
85
86 The file name of the user's login shell.
87
88
89 __TERM__
90
91
92 The terminal type for which output is to be
93 prepared.
94
95
96 __PAGER__
97
98
99 The user's preferred utility to display text
100 files.
101
102
103 __EDITOR__/__VISUAL__
104
105
106 The user's preferred utility to edit text
107 files.
108
109
110 __BROWSER__
111
112
113 The user's preferred utility to browse URLs. Sequence of
114 colon-separated browser commands. See
115 http://www.tuxedo.org/~esr/BROWSER/ .
116
117
118 Further names may be placed in the environment by the
119 __export__ command and `name=value' in sh(1), or
120 by the __setenv__ command if you use csh(1).
121 Arguments may also be placed in the environment at the point
122 of an exec(2). A C program can manipulate its
123 environment using the functions getenv(3),
124 putenv(3), setenv(3) and
125 unsetenv(3).
126
127
128 Note that the behaviour of many programs and library
129 routines is influenced by the presence or value of certain
130 environment variables. A random collection:
131
132
133 The variables __LANG__, __LANGUAGE__, __NLSPATH__,
134 __LOCPATH__, __LC_ALL__, __LC_MESSAGES__, etc.
135 influence locale handling, cf.
136 locale(5).
137
138
139 __TMPDIR__ influences the path prefix of names created by
140 __tmpnam(3)__ and other routines, the temporary directory
141 used by sort(1) and other programs, etc.
142
143
144 __LD_LIBRARY_PATH__, __LD_PRELOAD__ and other LD_*
145 variables influence the behaviour of the dynamic
146 loader/linker.
147
148
149 __POSIXLY_CORRECT__ makes certain programs and library
150 routines follow the prescriptions of POSIX.
151
152
153 The behaviour of malloc(3) is influenced by MALLOC_*
154 variables.
155
156
157 The variable __HOSTALIASES__ gives the name of a file
158 containing aliases to be used with
159 gethostbyname(3).
160
161
162 __TZ__ and __TZDIR__ give time zone
163 information.
164
165
166 __TERMCAP__ gives information on how to address a given
167 terminal (or gives the name of a file containing such
168 information).
169
170
171 __COLUMNS__ and __LINES__ tell applications about the
172 window size, possibly overriding the actual
173 size.
174
175
176 __PRINTER__ or __LPDEST__ may specify the desired
177 printer to use. Etc. etc.
178 !!BUGS
179
180
181 Clearly there is a security risk here. Many a system command
182 has been tricked into mischief by a user who specified
183 unusual values for __IFS__ or
184 __LD_LIBRARY_PATH__.
185
186
187 There is also the risk of name space pollution. Programs
188 like ''make'' and ''autoconf'' allow overriding of
189 default utility names from the environment with similarly
190 named variables in all caps. Thus one uses __CC__ to
191 select the desired C compiler (and similarly __MAKE__,
192 __AR__, __AS__, __FC__, __LD__, __LEX__,
193 __RM__, __YACC__, etc.). However, in some traditional
194 uses such an environment variable gives options for the
195 program instead of a pathname. Thus one has __MORE__,
196 __LESS__, and __GZIP__. Such usage is considered
197 mistaken, and to be avoided in new programs. The authors of
198 ''gzip'' should consider renaming their option to
199 __GZIP_OPT__.
200 !!SEE ALSO
201
202
203 login(1), sh(1), bash(1),
204 csh(1), tcsh(1), execve(2),
205 exec(3), getenv(3), putenv(3),
206 setenv(3), unsetenv(3),
207 locale(5)
208 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.