getenv.3
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3 代码 · 共 61 行
3
61 行
.\" SCCSID: @(#)getenv.3 8.1 9/11/90.TH getenv 3.SH Namegetenv, setenv, unsetenv \- manipulate environment variables.SH Syntax.nf.B char *getenv(\fIname\fP).B char *\fIname\fP;.PP.B setenv(\fIname\fP, \fIvalue\fP, \fIoverwrite\fP).B char *\fIname\fP, \fIvalue\fP;.B int \fIoverwrite\fP;.PP.B void unsetenv(\fIname\fP).B char *\fIname\fP;.fi.SH Description.NXR "getenv subroutine (standard C)".NXR "environment" "getting variable values"The.PN getenvsubroutine searches the environment listfor a string of the form.I name = valueand returns a pointer to the string.I valueif such a string is present, otherwise .PN getenvreturns the value 0 (NULL).For further information, see .MS environ 7 ..PPThe .PN setenv subroutine searches the environment list in the same manner as .PN getenv. If the string \fIname\fP is not found, a string of the form\fIname\fP=\fIvalue\fP is added to the environment. If it isfound, and \fIoverwrite\fP is non-zero, its value is changed to\fIvalue\fP. The.PN setenv subroutine returns 0 on success and \-1 on failure,where failure is caused by an inability to allocate space for theenvironment..PPThe .PN unsetenv subroutine removes all occurrences of the string \fIname\fP fromthe environment. There is no library provision for completely removingthe current environment. It is suggested that the following code beused to do so..EXstatic char *envinit[1];extern char **environ;environ = envinit;.EEAll of these routines permit, but do not require, a trailing equalssign (=) on \fIname\fP or a leading equals sign on \fIvalue\fP..SH See Also csh(1), sh(1), execve(2), putenv(3), environ(7)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?