axf-os161 / man / libc / getenv.html
getenv.html
Raw
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
	The President and Fellows of Harvard College.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
   may be used to endorse or promote products derived from this software
   without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.  IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>getenv</title>
<body bgcolor=#ffffff>
<h2 align=center>getenv</h2>
<h4 align=center>OS/161 Reference Manual</h4>

<h3>Name</h3>
<p>
getenv - retrieve an environment variable
</p>

<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>

<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>getenv(const char *</tt><em>variable</em><tt>);</tt>
</p>

<h3>Description</h3>
<p>
<tt>getenv</tt> retrieves the value of the environment variable
<em>variable</em> from the current process environment.
Unless you implement <tt>execve</tt> and environment variable passing,
the environment used is a default environment compiled into libc.
</p>

<h3>Return Values</h3>
<p>
On success, <tt>getenv</tt> returns a pointer to the value of the
requested variable.
This pointer points to internal storage and the contents should not be
modified.
The contents will in turn be stable until/unless the process
environment is modified.
If the requested variable is not found, <tt>getenv</tt> returns
<tt>NULL</tt>.
</p>

<h3>See Also</h3>
<p>
<A HREF=execvp.html>execvp</A>
</p>

</body>
</html>