📄 envlib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/envLib.html - generated by refgen from envLib.c --> <title> envLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual : Libraries</i></a></p></blockquote><h1>envLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>envLib</strong> - environment variable library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./envLib.html#envLibInit">envLibInit</a></i>( )</b> - initialize environment variable facility<br><b><i><a href="./envLib.html#envPrivateCreate">envPrivateCreate</a></i>( )</b> - create a private environment<br><b><i><a href="./envLib.html#envPrivateDestroy">envPrivateDestroy</a></i>( )</b> - destroy a private environment<br><b><i><a href="./envLib.html#putenv">putenv</a></i>( )</b> - set an environment variable<br><b><i><a href="./envLib.html#getenv">getenv</a></i>( )</b> - get an environment variable (ANSI)<br><b><i><a href="./envLib.html#envShow">envShow</a></i>( )</b> - display the environment for a task<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides a UNIX-compatible environment variable facility. Environment variables are created or modified with a call to <b><i><a href="./envLib.html#putenv">putenv</a></i>( )</b>:<pre> putenv ("variableName=value");</pre>The value of a variable may be retrieved with a call to <b><i><a href="./envLib.html#getenv">getenv</a></i>( )</b>, which returnsa pointer to the value string.<p>Tasks may share a common set of environment variables, or they may optionallycreate their own private environments, either automatically when the taskcreate hook is installed, or by an explicit call to <b><i><a href="./envLib.html#envPrivateCreate">envPrivateCreate</a></i>( )</b>.The task must be spawned with the <b>VX_PRIVATE_ENV</b> option set to receive aprivate set of environment variables. Private environments created by thetask creation hook inherit the values of the environment of the task that called<b><i><a href="./taskLib.html#taskSpawn">taskSpawn</a></i>( )</b> (since task create hooks run in the context of the calling task).<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>envLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./envLib.html#top">envLib</a></b>, UNIX BSD 4.3 manual entry for <b>environ(5V)</b>, * <i>American National Standard for Information Systems - </i>* <i>Programming Language - C, ANSI X3.159-1989: General Utilities (<b>stdlib.h</b>) </i><hr><a name="envLibInit"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>envLibInit</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>envLibInit</i>( )</strong> - initialize environment variable facility</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS envLibInit ( BOOL installHooks )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>If <i>installHooks</i> is TRUE, task create and delete hooks are installed thatwill optionally create and destroy private environments for the task beingcreated or destroyed, depending on the state of <b>VX_PRIVATE_ENV</b> in the taskoptions word. If <i>installHooks</i> is FALSE and a task requires a privateenvironment, it is the application's responsibility to create and destroythe private environment, using <b><i><a href="./envLib.html#envPrivateCreate">envPrivateCreate</a></i>( )</b> and <b><i><a href="./envLib.html#envPrivateDestroy">envPrivateDestroy</a></i>( )</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if an environment cannot be allocated or the hookscannot be installed.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./envLib.html#top">envLib</a></b><hr><a name="envPrivateCreate"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>envPrivateCreate</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>envPrivateCreate</i>( )</strong> - create a private environment</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS envPrivateCreate ( int taskId, /* task to have private environment */ int envSource /* -1 = make an empty private environment 0 = copy global to new private env taskId = copy the specified */ /* env */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine creates a private set of environment variables for a specifiedtask, if the environment variable task create hook is not installed.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if memory is insufficient.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><i><a href="./envLib.html#envLibInit">envLibInit</a></i>( )</b>, <b><i><a href="./envLib.html#envPrivateDestroy">envPrivateDestroy</a></i>( )</b><hr><a name="envPrivateDestroy"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>envPrivateDestroy</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>envPrivateDestroy</i>( )</strong> - destroy a private environment</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS envPrivateDestroy ( int taskId /* task with private env to destroy */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine destroys a private set of environment variables that werecreated with <b><i><a href="./envLib.html#envPrivateCreate">envPrivateCreate</a></i>( )</b>. Calling this routine is unnecessary ifthe environment variable task create hook is installed and the taskwas spawned with <b>VX_PRIVATE_ENV</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the task does not exist.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./envLib.html#top">envLib</a></b>, <b><i><a href="./envLib.html#envPrivateCreate">envPrivateCreate</a></i>( )</b><hr><a name="putenv"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>putenv</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>putenv</i>( )</strong> - set an environment variable</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS putenv ( char * pEnvString /* string to add to env */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets an environment variable to a value by altering anexisting variable or creating a new one. The parameter points to a stringof the form "variableName=value". Unlike the UNIX implementation, the stringpassed as a parameter is copied to a private buffer.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if space cannot be malloc'd.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><i><a href="./envLib.html#envLibInit">envLibInit</a></i>( )</b>, <b><i><a href="./envLib.html#getenv">getenv</a></i>( )</b><hr><a name="getenv"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>getenv</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>getenv</i>( )</strong> - get an environment variable (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>char *getenv ( const char * name /* env variable to get value for */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine searches the environment list (see the UNIX BSD 4.3 manualentry for <b>environ(5V)</b>) for a string of the form "name=value" andreturns the value portion of the string, if the string is present;otherwise it returns a NULL pointer.<p></blockquote><h4>RETURNS</h4><blockquote><p>A pointer to the string value, or a NULL pointer.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><i><a href="./envLib.html#envLibInit">envLibInit</a></i>( )</b>, <b><i><a href="./envLib.html#putenv">putenv</a></i>( )</b>, UNIX BSD 4.3 manual entryfor <b>environ(5V)</b>, <i>American National Standard for Information Systems - </i><i>Programming Language - C, ANSI X3.159-1989: General Utilities (<b>stdlib.h</b>) </i><hr><a name="envShow"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>envShow</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>envShow</i>( )</strong> - display the environment for a task</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void envShow ( int taskId /* task for which environment is printed */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine prints to standard output all the environment variables for aspecified task. If <i>taskId</i> is NULL, then the calling task's environmentis displayed.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./envLib.html#top">envLib</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -