Imported upstream version 1.5
[manpages-zh.git] / src / man5 / environ.5
blob08d8b6d68eaf528c03d0e0cd97f887728c8d4940
1 .\" Copyright (c) 1993 Michael Haardt (michael@moria.de),
2 .\" Fri Apr 2 11:32:09 MET DST 1993
3 .\" and Andries Brouwer (aeb@cwi.nl), Fri Feb 14 21:47:50 1997.
4 .\"
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
9 .\"
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
14 .\"
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 .\" GNU General Public License for more details.
19 .\"
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, write to the Free
22 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
23 .\" USA.
24 .\" Chinese Version Copyright mhss, www.linuxforum.net, 2000
25 .\" 
26 .\" Modified Sun Jul 25 10:45:30 1993 by Rik Faith (faith@cs.unc.edu)
27 .\" Modified Sun Jul 21 21:25:26 1996 by Andries Brouwer (aeb@cwi.nl)
28 .\" Modified Mon Oct 21 17:47:19 1996 by Eric S. Raymond (esr@thyrsus.com)
29 .\" Modified Wed Aug 27 20:28:58 1997 by Nicol醩 Lichtmaier 
30 .\" Modified Mon Sep 21 00:00:26 1998 by Andries Brouwer (aeb@cwi.nl)
31 .TH ENVIRON(5) Linux Programmer's Manual ENVIRON(5)
34 .SH NAME
35 environ - 用户环境(变量)
37 .SH SYNOPSIS 总览
38 .ad l
39 .nf 
40 extern char **environ;
41 .br
42 .fi
43 .ad b
44 .SH DESCRIPTION 描述
45 变量 environ 指向的是一个叫 'environment'(环境)的字符串数组
46 (这个变量必须在用户程序中声明,但是在使用 libc4 或 libc5 以
47 及使用 glibc 并且定义了 _GNU_SOURCE 的情况下 ,它是在头文件
48 unistd.h 中声明的)。对于一个进程,这个字符串的数组是通过开
49 始进程的 exec(3) 调用来得到,习惯上,这些字符串的格式是
50 'name=value'(名称=值)。常用的例子是:
51 .TP
52 .B USER
53 登录用户的名字(被一些从 BSD 派生来程序所使用)。
54 .TP
55 .B LOGNAME
56 登录用户的名字(被一些从 System-V 派生来程序所使用)。
57 .TP
58 .B HOME
59 用户的登录目录,被login(1)按口令文件 passwd(5) 设置。
60 .TP
61 .B LANG
62 当不被 LC_ALL 或更特殊的环境变量所忽略的时候,是用
63 于地域分类的地域名。
64 .TP
65 .B PATH
66 预先设定的目录前缀的序列,sh(1) 和许多程序可借此查找路径
67 名不完全的文件。前缀由':'分隔。(类似的,有一些 shell
68 用 CDPATH 查找位于不同目录的命令,以及用 MANPATH 找
69 手册页等等。)
70 .TP
71 .B PWD
72 当前的工作路径。被一些 shell 设置。
73 .TP
74 .B SHELL
75 用户的登录 shell 的文件名。
76 .TP
77 .B TERM
78 用于准备输出的终端类型。 
79 .TP
80 .B PAGER
81 用户指定的显示文本文件的工具。
82 .TP
83 .B EDITOR/VISUAL
84 用户指定的编辑文本文件的工具。
85 .PP
86 更多的名字可以通过和在 sh(1) 中的 export 命令和 'name=value',或 csh(1) 中
87 的 setenv 命令设置。参数也可以在
88 执行 exec(2) 的时候被放置在环境中。一个 C 程序可以使用函数
89 .BR getenv(3) 、
90 .BR putenv(3) 、
91 .BR setenv(3) 
92 和 
93 .BR unsetenv(3)
94 来操纵自身的环境。
96 注意许多程序和库例程的行为受特定的环境变量的存在和值的影响。
97 随便的搜集一下就有:
98 .LP
99 环境变量 LANG、LANGUAGE、NLSPATH、LOCPATH、LC_ALL、
100 LC_MESSAGES 等影响地域的处理。
102 TMPDIR 影响 tmpnam(3) 生成名字的路径名前缀和其他一些例程,
103 sort(1) 和其他程序用的临时文件目录等等。
104 .LP 
105 LD_LIBRARY_PATH、LD_PRELOAD 和其他 LD_* 变量影响动态 
106 (装载器/连接器)的行为。
108 POSIXLY_CORRECT 使特定的程序和库例程遵循 POSIX 规定。 
110 MALLOC_* 变量影响 malloc(3) 的行为。
112 HOSTALIASES 变量给出包含 gethostbyname(3) 用的别名的文件的
113 文件名。
115 TZ 和 TZDIR 给出时区信息。
117 TERMCAP 给出给定终端的窗口大小(或给出包含这种信息的文件的
118 文件名)。
120 等等,还有很多。
122 这里有一个明显的安全风险。不止一个系统命令曾经被一个使用了一
123 个不寻常的
124 .BR IFS " 或 " LD_LIBRARY_PATH
125 变量值的用户诱入骗局中。
128 .SH SEE ALSO 又见
129 .BR login(1),
130 .BR sh(1),
131 .BR bash(1),
132 .BR csh(1),
133 .BR tcsh(1),
134 .BR execve(2),
135 .BR exec(3), 
136 .BR getenv(3),
137 .BR putenv(3),
138 .BR setenv(3),
139 .BR unsetenv(3).
141 .SH "[中文版维护人]"
142 .B mhss <jijingzhisheng@up369.com>
143 .SH "[中文版最新更新]"
144 .B 2000/11/26
145 .SH "《中国linux论坛man手册页翻译计划》:"
146 .BI http://cmpp.linuxforum.net