Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <title>luaposix 33.3.0 Reference</title>
    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">


<!-- Menu -->

<div id="navigation">
<br/>
<h1>luaposix 33.3.0</h1>

<ul>
  <li><a href="../index.html">Index</a></li>
</ul>

<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>


<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
  <li><a href="../modules/posix.html">posix</a></li>
  <li><a href="../modules/posix.ctype.html">posix.ctype</a></li>
  <li><a href="../modules/posix.curses.html">posix.curses</a></li>
  <li><a href="../modules/posix.dirent.html">posix.dirent</a></li>
  <li><a href="../modules/posix.errno.html">posix.errno</a></li>
  <li><a href="../modules/posix.fcntl.html">posix.fcntl</a></li>
  <li><a href="../modules/posix.fnmatch.html">posix.fnmatch</a></li>
  <li><a href="../modules/posix.getopt.html">posix.getopt</a></li>
  <li><a href="../modules/posix.glob.html">posix.glob</a></li>
  <li><a href="../modules/posix.grp.html">posix.grp</a></li>
  <li><a href="../modules/posix.libgen.html">posix.libgen</a></li>
  <li><a href="../modules/posix.poll.html">posix.poll</a></li>
  <li><a href="../modules/posix.pwd.html">posix.pwd</a></li>
  <li><a href="../modules/posix.sched.html">posix.sched</a></li>
  <li><a href="../modules/posix.signal.html">posix.signal</a></li>
  <li><a href="../modules/posix.stdio.html">posix.stdio</a></li>
  <li><strong>posix.stdlib</strong></li>
  <li><a href="../modules/posix.sys.msg.html">posix.sys.msg</a></li>
  <li><a href="../modules/posix.sys.resource.html">posix.sys.resource</a></li>
  <li><a href="../modules/posix.sys.socket.html">posix.sys.socket</a></li>
  <li><a href="../modules/posix.sys.stat.html">posix.sys.stat</a></li>
  <li><a href="../modules/posix.sys.statvfs.html">posix.sys.statvfs</a></li>
  <li><a href="../modules/posix.sys.time.html">posix.sys.time</a></li>
  <li><a href="../modules/posix.sys.times.html">posix.sys.times</a></li>
  <li><a href="../modules/posix.sys.utsname.html">posix.sys.utsname</a></li>
  <li><a href="../modules/posix.sys.wait.html">posix.sys.wait</a></li>
  <li><a href="../modules/posix.syslog.html">posix.syslog</a></li>
  <li><a href="../modules/posix.termio.html">posix.termio</a></li>
  <li><a href="../modules/posix.time.html">posix.time</a></li>
  <li><a href="../modules/posix.unistd.html">posix.unistd</a></li>
  <li><a href="../modules/posix.utime.html">posix.utime</a></li>
</ul>
<h2>Classes</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
  <li><a href="../classes/posix.curses.chstr.html">posix.curses.chstr</a></li>
  <li><a href="../classes/posix.curses.window.html">posix.curses.window</a></li>
</ul>
<h2>Examples</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
  <li><a href="../examples/curses.lua.html">curses.lua</a></li>
  <li><a href="../examples/dir.lua.html">dir.lua</a></li>
  <li><a href="../examples/fork.lua.html">fork.lua</a></li>
  <li><a href="../examples/fork2.lua.html">fork2.lua</a></li>
  <li><a href="../examples/getopt.lua.html">getopt.lua</a></li>
  <li><a href="../examples/glob.lua.html">glob.lua</a></li>
  <li><a href="../examples/limit.lua.html">limit.lua</a></li>
  <li><a href="../examples/lock.lua.html">lock.lua</a></li>
  <li><a href="../examples/netlink-uevent.lua.html">netlink-uevent.lua</a></li>
  <li><a href="../examples/ping.lua.html">ping.lua</a></li>
  <li><a href="../examples/poll.lua.html">poll.lua</a></li>
  <li><a href="../examples/rt_sched.lua.html">rt_sched.lua</a></li>
  <li><a href="../examples/signal.lua.html">signal.lua</a></li>
  <li><a href="../examples/socket.lua.html">socket.lua</a></li>
  <li><a href="../examples/termios.lua.html">termios.lua</a></li>
  <li><a href="../examples/tree.lua.html">tree.lua</a></li>
</ul>

</div>

<div id="content">

<h1>Module <code>posix.stdlib</code></h1>
<p>Standard Posix Library functions.</p>
<p>

</p>


<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#abort">abort ()</a></td>
	<td class="summary">Abort the program immediately.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#getenv">getenv ([name])</a></td>
	<td class="summary">Get value of environment variable, or <em>all</em> variables.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#grantpt">grantpt (fd)</a></td>
	<td class="summary">Grant access to a slave pseudoterminal</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#mkdtemp">mkdtemp (templ)</a></td>
	<td class="summary">Create a unique temporary directory.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#mkstemp">mkstemp (templ)</a></td>
	<td class="summary">Create a unique temporary file.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#openpt">openpt (oflags)</a></td>
	<td class="summary">Open a pseudoterminal.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#ptsname">ptsname (fd)</a></td>
	<td class="summary">Get the name of a slave pseudo-terminal</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#realpath">realpath (path)</a></td>
	<td class="summary">Find canonicalized absolute pathname.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#setenv">setenv (name[, value[, overwrite]])</a></td>
	<td class="summary">Set an environment variable for this process.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#unlockpt">unlockpt (fd)</a></td>
	<td class="summary">Unlock a pseudoterminal master/slave pair</td>
	</tr>
</table>

<br/>
<br/>


    <h2><a name="Functions"></a>Functions</h2>

    <dl class="function">
    <dt>
    <a name = "abort"></a>
    <strong>abort ()</strong>
    </dt>
    <dd>
    Abort the program immediately.





    <h3>See also:</h3>
    <ul>
         <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/abort.html">abort(3)</a>
    </ul>


</dd>
    <dt>
    <a name = "getenv"></a>
    <strong>getenv ([name])</strong>
    </dt>
    <dd>
    Get value of environment variable, or <em>all</em> variables.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">name</span>
            <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
         if nil, get all
         (<em>optional</em>)
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        value if name given, otherwise a name-indexed table of values.
    </ol>


    <h3>See also:</h3>
    <ul>
         <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/getenv.html">getenv(3)</a>
    </ul>

    <h3>Usage:</h3>
    <ul>
        <pre class="example"><span class="keyword">for</span> a,b <span class="keyword">in</span> <span class="global">pairs</span>(posix.getenv()) <span class="keyword">do</span> <span class="global">print</span>(a, b) <span class="keyword">end</span></pre>
    </ul>

</dd>
    <dt>
    <a name = "grantpt"></a>
    <strong>grantpt (fd)</strong>
    </dt>
    <dd>
    Grant access to a slave pseudoterminal


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">fd</span>
            <span class="types"><span class="type">int</span></span>
         descriptor returned by openpt
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">int</span></span>
        <code>0</code>, if successful
    </ol>
     <h3>Or</h3>
    <ol>
        <li>
        nil</li>
        <li>
           <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        error message</li>
        <li>
           <span class="types"><span class="type">int</span></span>
        errnum</li>
    </ol>


    <h3>See also:</h3>
    <ul>
         <li><a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/grantpt.html">grantpt(3)</a></li>
         <li><a href="../modules/posix.stdlib.html#openpt">openpt</a></li>
         <li><a href="../modules/posix.stdlib.html#ptsname">ptsname</a></li>
         <li><a href="../modules/posix.stdlib.html#unlockpt">unlockpt</a></li>
    </ul>


</dd>
    <dt>
    <a name = "mkdtemp"></a>
    <strong>mkdtemp (templ)</strong>
    </dt>
    <dd>
    Create a unique temporary directory.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">templ</span>
            <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
         pattern that ends in six 'X' characters
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        path to directory, if successful
    </ol>
     <h3>Or</h3>
    <ol>
        <li>
        nil</li>
        <li>
           <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        error message</li>
        <li>
           <span class="types"><span class="type">int</span></span>
        errnum</li>
    </ol>


    <h3>See also:</h3>
    <ul>
         <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/mkdtemp.html">mkdtemp(3)</a>
    </ul>


</dd>
    <dt>
    <a name = "mkstemp"></a>
    <strong>mkstemp (templ)</strong>
    </dt>
    <dd>
    Create a unique temporary file.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">templ</span>
            <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
         pattern that ends in six 'X' characters
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">int</span></span>
        open file descriptor
    </ol>
     <h3>Or</h3>
    <ol>
        <li>
           <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        path to file, if successful</li>
        <li>
        nil</li>
        <li>
           <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        error message</li>
        <li>
           <span class="types"><span class="type">int</span></span>
        errnum</li>
    </ol>


    <h3>See also:</h3>
    <ul>
         <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/mkstemp.html">mkstemp(3)</a>
    </ul>

    <h3>Usage:</h3>
    <ul>
        <pre class="example">P.mkstemp <span class="string">'wooXXXXXX'</span></pre>
    </ul>

</dd>
    <dt>
    <a name = "openpt"></a>
    <strong>openpt (oflags)</strong>
    </dt>
    <dd>
    Open a pseudoterminal.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">oflags</span>
            <span class="types"><span class="type">int</span></span>
         bitwise OR of zero or more of <code>O_RDWR</code> and <code>O_NOCTTY</code>
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        file descriptor of pseudoterminal, if successful
    </ol>
     <h3>Or</h3>
    <ol>
        <li>
        nil</li>
        <li>
           <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        error message</li>
        <li>
           <span class="types"><span class="type">int</span></span>
        errnum</li>
    </ol>


    <h3>See also:</h3>
    <ul>
         <li><a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/posix_openpt.html">posix_openpt(3)</a></li>
         <li><a href="../modules/posix.stdlib.html#grantpt">grantpt</a></li>
         <li><a href="../modules/posix.stdlib.html#ptsname">ptsname</a></li>
         <li><a href="../modules/posix.stdlib.html#unlockpt">unlockpt</a></li>
    </ul>


</dd>
    <dt>
    <a name = "ptsname"></a>
    <strong>ptsname (fd)</strong>
    </dt>
    <dd>
    Get the name of a slave pseudo-terminal


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">fd</span>
            <span class="types"><span class="type">int</span></span>
         descriptor returned by <a href="../modules/posix.stdlib.html#openpt">openpt</a>
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        path name of the slave terminal device, if successful
    </ol>
     <h3>Or</h3>
    <ol>
        <li>
        nil</li>
        <li>
           <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        error message</li>
        <li>
           <span class="types"><span class="type">int</span></span>
        errnum</li>
    </ol>


    <h3>See also:</h3>
    <ul>
         <li><a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/ptsname.html">ptsname(3)</a></li>
         <li><a href="../modules/posix.stdlib.html#grantpt">grantpt</a></li>
         <li><a href="../modules/posix.stdlib.html#unlockpt">unlockpt</a></li>
    </ul>


</dd>
    <dt>
    <a name = "realpath"></a>
    <strong>realpath (path)</strong>
    </dt>
    <dd>
    Find canonicalized absolute pathname.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">path</span>
            <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
         file to act on
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        canonicalized absolute path, if successful
    </ol>
     <h3>Or</h3>
    <ol>
        <li>
        nil</li>
        <li>
           <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        error messag</li>
        <li>
           <span class="types"><span class="type">int</span></span>
        errnum</li>
    </ol>


    <h3>See also:</h3>
    <ul>
         <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/realpath.html">realpath(3)</a>
    </ul>


</dd>
    <dt>
    <a name = "setenv"></a>
    <strong>setenv (name[, value[, overwrite]])</strong>
    </dt>
    <dd>
    Set an environment variable for this process.
(Child processes will inherit this)


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">name</span>
            <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>



        </li>
        <li><span class="parameter">value</span>
            <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
         (maybe nil, meaning 'unset')
         (<em>optional</em>)
        </li>
        <li><span class="parameter">overwrite</span>
         non-nil prevents overwriting a variable
         (<em>optional</em>)
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">int</span></span>
        <code>0</code>, if successful
    </ol>
     <h3>Or</h3>
    <ol>
        <li>
        nil</li>
        <li>
           <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        error message</li>
        <li>
           <span class="types"><span class="type">int</span></span>
        errnum</li>
    </ol>


    <h3>See also:</h3>
    <ul>
         <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/setenv.html">setenv(3)</a>
    </ul>


</dd>
    <dt>
    <a name = "unlockpt"></a>
    <strong>unlockpt (fd)</strong>
    </dt>
    <dd>
    Unlock a pseudoterminal master/slave pair


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">fd</span>
            <span class="types"><span class="type">int</span></span>
         descriptor returned by openpt
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">int</span></span>
        <code>0</code>, if successful
    </ol>
     <h3>Or</h3>
    <ol>
        <li>
        nil</li>
        <li>
           <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        error message</li>
        <li>
           <span class="types"><span class="type">int</span></span>
        errnum</li>
    </ol>


    <h3>See also:</h3>
    <ul>
         <li><a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/unlockpt.html">unlockpt(3)</a></li>
         <li><a href="../modules/posix.stdlib.html#openpt">openpt</a></li>
         <li><a href="../modules/posix.stdlib.html#ptsname">ptsname</a></li>
         <li><a href="../modules/posix.stdlib.html#grantpt">grantpt</a></li>
    </ul>


</dd>
</dl>


</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
<i style="float:right;">Last updated 2015-03-01 09:06:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>