blob: 294c1d5682d82a78cdadf80edcea74de5319534f [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GNU libiberty</title>
<meta name="description" content="GNU libiberty">
<meta name="keywords" content="GNU libiberty">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="#Top" rel="start" title="Top">
<link href="#Index" rel="index" title="Index">
<link href="#SEC_Contents" rel="contents" title="Table of Contents">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<h1 class="settitle" align="center"><small>GNU</small> libiberty</h1>
<a name="SEC_Contents"></a>
<h2 class="contents-heading">Table of Contents</h2>
<div class="contents">
<ul class="no-bullet">
<li><a name="toc-Using-1" href="#Using">1 Using</a></li>
<li><a name="toc-Overview-1" href="#Overview">2 Overview</a>
<ul class="no-bullet">
<li><a name="toc-Supplemental-Functions-1" href="#Supplemental-Functions">2.1 Supplemental Functions</a></li>
<li><a name="toc-Replacement-Functions-1" href="#Replacement-Functions">2.2 Replacement Functions</a>
<ul class="no-bullet">
<li><a name="toc-Memory-Allocation-1" href="#Memory-Allocation">2.2.1 Memory Allocation</a></li>
<li><a name="toc-Exit-Handlers-1" href="#Exit-Handlers">2.2.2 Exit Handlers</a></li>
<li><a name="toc-Error-Reporting-1" href="#Error-Reporting">2.2.3 Error Reporting</a></li>
</ul></li>
<li><a name="toc-Extensions-1" href="#Extensions">2.3 Extensions</a>
<ul class="no-bullet">
<li><a name="toc-Obstacks-1" href="#Obstacks">2.3.1 Obstacks</a>
<ul class="no-bullet">
<li><a name="toc-Creating-Obstacks-1" href="#Creating-Obstacks">2.3.1.1 Creating Obstacks</a></li>
<li><a name="toc-Preparing-for-Using-Obstacks" href="#Preparing-for-Obstacks">2.3.1.2 Preparing for Using Obstacks</a></li>
<li><a name="toc-Allocation-in-an-Obstack-1" href="#Allocation-in-an-Obstack">2.3.1.3 Allocation in an Obstack</a></li>
<li><a name="toc-Freeing-Objects-in-an-Obstack" href="#Freeing-Obstack-Objects">2.3.1.4 Freeing Objects in an Obstack</a></li>
<li><a name="toc-Obstack-Functions-and-Macros" href="#Obstack-Functions">2.3.1.5 Obstack Functions and Macros</a></li>
<li><a name="toc-Growing-Objects-1" href="#Growing-Objects">2.3.1.6 Growing Objects</a></li>
<li><a name="toc-Extra-Fast-Growing-Objects" href="#Extra-Fast-Growing">2.3.1.7 Extra Fast Growing Objects</a></li>
<li><a name="toc-Status-of-an-Obstack-1" href="#Status-of-an-Obstack">2.3.1.8 Status of an Obstack</a></li>
<li><a name="toc-Alignment-of-Data-in-Obstacks" href="#Obstacks-Data-Alignment">2.3.1.9 Alignment of Data in Obstacks</a></li>
<li><a name="toc-Obstack-Chunks-1" href="#Obstack-Chunks">2.3.1.10 Obstack Chunks</a></li>
<li><a name="toc-Summary-of-Obstack-Functions" href="#Summary-of-Obstacks">2.3.1.11 Summary of Obstack Functions</a></li>
</ul></li>
</ul></li>
</ul></li>
<li><a name="toc-Function_002c-Variable_002c-and-Macro-Listing_002e" href="#Functions">3 Function, Variable, and Macro Listing.</a></li>
<li><a name="toc-Licenses-1" href="#Licenses">Appendix A Licenses</a>
<ul class="no-bullet">
<li><a name="toc-GNU-LESSER-GENERAL-PUBLIC-LICENSE" href="#Library-Copying">A.1 GNU LESSER GENERAL PUBLIC LICENSE</a>
<ul class="no-bullet">
<li><a name="toc-Preamble" href="#Preamble">A.1.1 Preamble</a></li>
<li><a name="toc-How-to-Apply-These-Terms-to-Your-New-Libraries" href="#How-to-Apply-These-Terms-to-Your-New-Libraries">A.1.2 How to Apply These Terms to Your New Libraries</a></li>
</ul></li>
<li><a name="toc-BSD-1" href="#BSD">A.2 BSD</a></li>
</ul></li>
<li><a name="toc-Index-1" href="#Index">Index</a></li>
</ul>
</div>
<a name="Top"></a>
<div class="header">
<p>
Next: <a href="#Using" accesskey="n" rel="next">Using</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Introduction"></a>
<h1 class="top">Introduction</h1>
<p>The <code>libiberty</code> library is a collection of subroutines used by various
GNU programs. It is available under the Library General Public
License; for more information, see <a href="#Library-Copying">Library Copying</a>.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Using" accesskey="1">Using</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How to use libiberty in your code.
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
</pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Overview" accesskey="2">Overview</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Overview of available function groups.
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
</pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Functions" accesskey="3">Functions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Available functions, macros, and global variables.
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
</pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Licenses" accesskey="4">Licenses</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">The various licenses under which libiberty sources are
distributed.
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
</pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Index" accesskey="5">Index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Index of functions and categories.
</td></tr>
</table>
<hr>
<a name="Using"></a>
<div class="header">
<p>
Next: <a href="#Overview" accesskey="n" rel="next">Overview</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Using-1"></a>
<h2 class="chapter">1 Using</h2>
<a name="index-using-libiberty"></a>
<a name="index-libiberty-usage"></a>
<a name="index-how-to-use"></a>
<p>To date, <code>libiberty</code> is generally not installed on its own. It has evolved
over years but does not have its own version number nor release schedule.
</p>
<p>Possibly the easiest way to use <code>libiberty</code> in your projects is to drop the
<code>libiberty</code> code into your project&rsquo;s sources, and to build the library along
with your own sources; the library would then be linked in at the end. This
prevents any possible version mismatches with other copies of libiberty
elsewhere on the system.
</p>
<p>Passing <samp>--enable-install-libiberty</samp> to the <code>configure</code>
script when building <code>libiberty</code> causes the header files and archive library
to be installed when <kbd>make install</kbd> is run. This option also takes
an (optional) argument to specify the installation location, in the same
manner as <samp>--prefix</samp>.
</p>
<p>For your own projects, an approach which offers stability and flexibility
is to include <code>libiberty</code> with your code, but allow the end user to optionally
choose to use a previously-installed version instead. In this way the
user may choose (for example) to install <code>libiberty</code> as part of GCC, and use
that version for all software built with that compiler. (This approach
has proven useful with software using the GNU <code>readline</code> library.)
</p>
<p>Making use of <code>libiberty</code> code usually requires that you include one or more
header files from the <code>libiberty</code> distribution. (They will be named as
necessary in the function descriptions.) At link time, you will need to
add <samp>-liberty</samp> to your link command invocation.
</p>
<hr>
<a name="Overview"></a>
<div class="header">
<p>
Next: <a href="#Functions" accesskey="n" rel="next">Functions</a>, Previous: <a href="#Using" accesskey="p" rel="prev">Using</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Overview-1"></a>
<h2 class="chapter">2 Overview</h2>
<p>Functions contained in <code>libiberty</code> can be divided into three general categories.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Supplemental-Functions" accesskey="1">Supplemental Functions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Providing functions which don&rsquo;t exist
on older operating systems.
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
</pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Replacement-Functions" accesskey="2">Replacement Functions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">These functions are sometimes buggy or
unpredictable on some operating systems.
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
</pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Extensions" accesskey="3">Extensions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Functions which provide useful extensions
or safety wrappers around existing code.
</td></tr>
</table>
<hr>
<a name="Supplemental-Functions"></a>
<div class="header">
<p>
Next: <a href="#Replacement-Functions" accesskey="n" rel="next">Replacement Functions</a>, Up: <a href="#Overview" accesskey="u" rel="up">Overview</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Supplemental-Functions-1"></a>
<h3 class="section">2.1 Supplemental Functions</h3>
<a name="index-supplemental-functions"></a>
<a name="index-functions_002c-supplemental"></a>
<a name="index-functions_002c-missing"></a>
<p>Certain operating systems do not provide functions which have since
become standardized, or at least common. For example, the Single
Unix Specification Version 2 requires that the <code>basename</code>
function be provided, but an OS which predates that specification
might not have this function. This should not prevent well-written
code from running on such a system.
</p>
<p>Similarly, some functions exist only among a particular &ldquo;flavor&rdquo;
or &ldquo;family&rdquo; of operating systems. As an example, the <code>bzero</code>
function is often not present on systems outside the BSD-derived
family of systems.
</p>
<p>Many such functions are provided in <code>libiberty</code>. They are quickly
listed here with little description, as systems which lack them
become less and less common. Each function <var>foo</var> is implemented
in <samp><var>foo</var>.c</samp> but not declared in any <code>libiberty</code> header file; more
comments and caveats for each function&rsquo;s implementation are often
available in the source file. Generally, the function can simply
be declared as <code>extern</code>.
</p>
<hr>
<a name="Replacement-Functions"></a>
<div class="header">
<p>
Next: <a href="#Extensions" accesskey="n" rel="next">Extensions</a>, Previous: <a href="#Supplemental-Functions" accesskey="p" rel="prev">Supplemental Functions</a>, Up: <a href="#Overview" accesskey="u" rel="up">Overview</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Replacement-Functions-1"></a>
<h3 class="section">2.2 Replacement Functions</h3>
<a name="index-replacement-functions"></a>
<a name="index-functions_002c-replacement"></a>
<p>Some functions have extremely limited implementations on different
platforms. Other functions are tedious to use correctly; for example,
proper use of <code>malloc</code> calls for the return value to be checked and
appropriate action taken if memory has been exhausted. A group of
&ldquo;replacement functions&rdquo; is available in <code>libiberty</code> to address these issues
for some of the most commonly used subroutines.
</p>
<p>All of these functions are declared in the <samp>libiberty.h</samp> header
file. Many of the implementations will use preprocessor macros set by
GNU Autoconf, if you decide to make use of that program. Some of these
functions may call one another.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Memory-Allocation" accesskey="1">Memory Allocation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Testing and handling failed memory
requests automatically.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Exit-Handlers" accesskey="2">Exit Handlers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Calling routines on program exit.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Error-Reporting" accesskey="3">Error Reporting</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Mapping errno and signal numbers to
more useful string formats.
</td></tr>
</table>
<hr>
<a name="Memory-Allocation"></a>
<div class="header">
<p>
Next: <a href="#Exit-Handlers" accesskey="n" rel="next">Exit Handlers</a>, Up: <a href="#Replacement-Functions" accesskey="u" rel="up">Replacement Functions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Memory-Allocation-1"></a>
<h4 class="subsection">2.2.1 Memory Allocation</h4>
<a name="index-memory-allocation"></a>
<p>The functions beginning with the letter &lsquo;<samp>x</samp>&rsquo; are wrappers around
standard functions; the functions provided by the system environment
are called and their results checked before the results are passed back
to client code. If the standard functions fail, these wrappers will
terminate the program. Thus, these versions can be used with impunity.
</p>
<hr>
<a name="Exit-Handlers"></a>
<div class="header">
<p>
Next: <a href="#Error-Reporting" accesskey="n" rel="next">Error Reporting</a>, Previous: <a href="#Memory-Allocation" accesskey="p" rel="prev">Memory Allocation</a>, Up: <a href="#Replacement-Functions" accesskey="u" rel="up">Replacement Functions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Exit-Handlers-1"></a>
<h4 class="subsection">2.2.2 Exit Handlers</h4>
<a name="index-exit-handlers"></a>
<p>The existence and implementation of the <code>atexit</code> routine varies
amongst the flavors of Unix. <code>libiberty</code> provides an unvarying dependable
implementation via <code>xatexit</code> and <code>xexit</code>.
</p>
<hr>
<a name="Error-Reporting"></a>
<div class="header">
<p>
Previous: <a href="#Exit-Handlers" accesskey="p" rel="prev">Exit Handlers</a>, Up: <a href="#Replacement-Functions" accesskey="u" rel="up">Replacement Functions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Error-Reporting-1"></a>
<h4 class="subsection">2.2.3 Error Reporting</h4>
<a name="index-error-reporting"></a>
<p>These are a set of routines to facilitate programming with the system
<code>errno</code> interface. The <code>libiberty</code> source file <samp>strerror.c</samp>
contains a good deal of documentation for these functions.
</p>
<hr>
<a name="Extensions"></a>
<div class="header">
<p>
Previous: <a href="#Replacement-Functions" accesskey="p" rel="prev">Replacement Functions</a>, Up: <a href="#Overview" accesskey="u" rel="up">Overview</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Extensions-1"></a>
<h3 class="section">2.3 Extensions</h3>
<a name="index-extensions"></a>
<a name="index-functions_002c-extension"></a>
<p><code>libiberty</code> includes additional functionality above and beyond standard
functions, which has proven generically useful in GNU programs, such as
obstacks and regex. These functions are often copied from other
projects as they gain popularity, and are included here to provide a
central location from which to use, maintain, and distribute them.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Obstacks" accesskey="1">Obstacks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Stacks of arbitrary objects.
</td></tr>
</table>
<hr>
<a name="Obstacks"></a>
<div class="header">
<p>
Up: <a href="#Extensions" accesskey="u" rel="up">Extensions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Obstacks-1"></a>
<h4 class="subsection">2.3.1 Obstacks</h4>
<a name="index-obstacks"></a>
<p>An <em>obstack</em> is a pool of memory containing a stack of objects. You
can create any number of separate obstacks, and then allocate objects in
specified obstacks. Within each obstack, the last object allocated must
always be the first one freed, but distinct obstacks are independent of
each other.
</p>
<p>Aside from this one constraint of order of freeing, obstacks are totally
general: an obstack can contain any number of objects of any size. They
are implemented with macros, so allocation is usually very fast as long as
the objects are usually small. And the only space overhead per object is
the padding needed to start each object on a suitable boundary.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Creating-Obstacks" accesskey="1">Creating Obstacks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How to declare an obstack in your program.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Preparing-for-Obstacks" accesskey="2">Preparing for Obstacks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Preparations needed before you can
use obstacks.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Allocation-in-an-Obstack" accesskey="3">Allocation in an Obstack</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Allocating objects in an obstack.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Freeing-Obstack-Objects" accesskey="4">Freeing Obstack Objects</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Freeing objects in an obstack.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Obstack-Functions" accesskey="5">Obstack Functions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">The obstack functions are both
functions and macros.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Growing-Objects" accesskey="6">Growing Objects</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Making an object bigger by stages.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Extra-Fast-Growing" accesskey="7">Extra Fast Growing</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Extra-high-efficiency (though more
complicated) growing objects.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Status-of-an-Obstack" accesskey="8">Status of an Obstack</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Inquiries about the status of an obstack.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Obstacks-Data-Alignment" accesskey="9">Obstacks Data Alignment</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Controlling alignment of objects in obstacks.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Obstack-Chunks">Obstack Chunks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How obstacks obtain and release chunks;
efficiency considerations.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Summary-of-Obstacks">Summary of Obstacks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Creating-Obstacks"></a>
<div class="header">
<p>
Next: <a href="#Preparing-for-Obstacks" accesskey="n" rel="next">Preparing for Obstacks</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Creating-Obstacks-1"></a>
<h4 class="subsubsection">2.3.1.1 Creating Obstacks</h4>
<p>The utilities for manipulating obstacks are declared in the header
file <samp>obstack.h</samp>.
<a name="index-obstack_002eh"></a>
</p>
<dl>
<dt><a name="index-struct-obstack"></a>Data Type: <strong>struct obstack</strong></dt>
<dd><p>An obstack is represented by a data structure of type <code>struct
obstack</code>. This structure has a small fixed size; it records the status
of the obstack and how to find the space in which objects are allocated.
It does not contain any of the objects themselves. You should not try
to access the contents of the structure directly; use only the functions
described in this chapter.
</p></dd></dl>
<p>You can declare variables of type <code>struct obstack</code> and use them as
obstacks, or you can allocate obstacks dynamically like any other kind
of object. Dynamic allocation of obstacks allows your program to have a
variable number of different stacks. (You can even allocate an
obstack structure in another obstack, but this is rarely useful.)
</p>
<p>All the functions that work with obstacks require you to specify which
obstack to use. You do this with a pointer of type <code>struct obstack
*</code>. In the following, we often say &ldquo;an obstack&rdquo; when strictly
speaking the object at hand is such a pointer.
</p>
<p>The objects in the obstack are packed into large blocks called
<em>chunks</em>. The <code>struct obstack</code> structure points to a chain of
the chunks currently in use.
</p>
<p>The obstack library obtains a new chunk whenever you allocate an object
that won&rsquo;t fit in the previous chunk. Since the obstack library manages
chunks automatically, you don&rsquo;t need to pay much attention to them, but
you do need to supply a function which the obstack library should use to
get a chunk. Usually you supply a function which uses <code>malloc</code>
directly or indirectly. You must also supply a function to free a chunk.
These matters are described in the following section.
</p>
<hr>
<a name="Preparing-for-Obstacks"></a>
<div class="header">
<p>
Next: <a href="#Allocation-in-an-Obstack" accesskey="n" rel="next">Allocation in an Obstack</a>, Previous: <a href="#Creating-Obstacks" accesskey="p" rel="prev">Creating Obstacks</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Preparing-for-Using-Obstacks"></a>
<h4 class="subsubsection">2.3.1.2 Preparing for Using Obstacks</h4>
<p>Each source file in which you plan to use the obstack functions
must include the header file <samp>obstack.h</samp>, like this:
</p>
<div class="smallexample">
<pre class="smallexample">#include &lt;obstack.h&gt;
</pre></div>
<a name="index-obstack_005fchunk_005falloc"></a>
<a name="index-obstack_005fchunk_005ffree"></a>
<p>Also, if the source file uses the macro <code>obstack_init</code>, it must
declare or define two functions or macros that will be called by the
obstack library. One, <code>obstack_chunk_alloc</code>, is used to allocate
the chunks of memory into which objects are packed. The other,
<code>obstack_chunk_free</code>, is used to return chunks when the objects in
them are freed. These macros should appear before any use of obstacks
in the source file.
</p>
<p>Usually these are defined to use <code>malloc</code> via the intermediary
<code>xmalloc</code> (see <a href="http://www.gnu.org/software/libc/manual/html_mono/libc.html#Unconstrained-Allocation">Unconstrained Allocation</a> in <cite>The GNU C Library Reference Manual</cite>). This is done with
the following pair of macro definitions:
</p>
<div class="smallexample">
<pre class="smallexample">#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
</pre></div>
<p>Though the memory you get using obstacks really comes from <code>malloc</code>,
using obstacks is faster because <code>malloc</code> is called less often, for
larger blocks of memory. See <a href="#Obstack-Chunks">Obstack Chunks</a>, for full details.
</p>
<p>At run time, before the program can use a <code>struct obstack</code> object
as an obstack, it must initialize the obstack by calling
<code>obstack_init</code>.
</p>
<dl>
<dt><a name="index-obstack_005finit"></a>Function: <em>int</em> <strong>obstack_init</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
<dd><p>Initialize obstack <var>obstack-ptr</var> for allocation of objects. This
function calls the obstack&rsquo;s <code>obstack_chunk_alloc</code> function. If
allocation of memory fails, the function pointed to by
<code>obstack_alloc_failed_handler</code> is called. The <code>obstack_init</code>
function always returns 1 (Compatibility notice: Former versions of
obstack returned 0 if allocation failed).
</p></dd></dl>
<p>Here are two examples of how to allocate the space for an obstack and
initialize it. First, an obstack that is a static variable:
</p>
<div class="smallexample">
<pre class="smallexample">static struct obstack myobstack;
&hellip;
obstack_init (&amp;myobstack);
</pre></div>
<p>Second, an obstack that is itself dynamically allocated:
</p>
<div class="smallexample">
<pre class="smallexample">struct obstack *myobstack_ptr
= (struct obstack *) xmalloc (sizeof (struct obstack));
obstack_init (myobstack_ptr);
</pre></div>
<dl>
<dt><a name="index-obstack_005falloc_005ffailed_005fhandler"></a>Variable: <strong>obstack_alloc_failed_handler</strong></dt>
<dd><p>The value of this variable is a pointer to a function that
<code>obstack</code> uses when <code>obstack_chunk_alloc</code> fails to allocate
memory. The default action is to print a message and abort.
You should supply a function that either calls <code>exit</code>
(see <a href="http://www.gnu.org/software/libc/manual/html_mono/libc.html#Program-Termination">Program Termination</a> in <cite>The GNU C Library Reference Manual</cite>) or <code>longjmp</code> (see <a href="http://www.gnu.org/software/libc/manual/html_mono/libc.html#Non_002dLocal-Exits">Non-Local
Exits</a> in <cite>The GNU C Library Reference Manual</cite>) and doesn&rsquo;t return.
</p>
<div class="smallexample">
<pre class="smallexample">void my_obstack_alloc_failed (void)
&hellip;
obstack_alloc_failed_handler = &amp;my_obstack_alloc_failed;
</pre></div>
</dd></dl>
<hr>
<a name="Allocation-in-an-Obstack"></a>
<div class="header">
<p>
Next: <a href="#Freeing-Obstack-Objects" accesskey="n" rel="next">Freeing Obstack Objects</a>, Previous: <a href="#Preparing-for-Obstacks" accesskey="p" rel="prev">Preparing for Obstacks</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Allocation-in-an-Obstack-1"></a>
<h4 class="subsubsection">2.3.1.3 Allocation in an Obstack</h4>
<a name="index-allocation-_0028obstacks_0029"></a>
<p>The most direct way to allocate an object in an obstack is with
<code>obstack_alloc</code>, which is invoked almost like <code>malloc</code>.
</p>
<dl>
<dt><a name="index-obstack_005falloc"></a>Function: <em>void *</em> <strong>obstack_alloc</strong> <em>(struct obstack *<var>obstack-ptr</var>, int <var>size</var>)</em></dt>
<dd><p>This allocates an uninitialized block of <var>size</var> bytes in an obstack
and returns its address. Here <var>obstack-ptr</var> specifies which obstack
to allocate the block in; it is the address of the <code>struct obstack</code>
object which represents the obstack. Each obstack function or macro
requires you to specify an <var>obstack-ptr</var> as the first argument.
</p>
<p>This function calls the obstack&rsquo;s <code>obstack_chunk_alloc</code> function if
it needs to allocate a new chunk of memory; it calls
<code>obstack_alloc_failed_handler</code> if allocation of memory by
<code>obstack_chunk_alloc</code> failed.
</p></dd></dl>
<p>For example, here is a function that allocates a copy of a string <var>str</var>
in a specific obstack, which is in the variable <code>string_obstack</code>:
</p>
<div class="smallexample">
<pre class="smallexample">struct obstack string_obstack;
char *
copystring (char *string)
{
size_t len = strlen (string) + 1;
char *s = (char *) obstack_alloc (&amp;string_obstack, len);
memcpy (s, string, len);
return s;
}
</pre></div>
<p>To allocate a block with specified contents, use the function
<code>obstack_copy</code>, declared like this:
</p>
<dl>
<dt><a name="index-obstack_005fcopy"></a>Function: <em>void *</em> <strong>obstack_copy</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>address</var>, int <var>size</var>)</em></dt>
<dd><p>This allocates a block and initializes it by copying <var>size</var>
bytes of data starting at <var>address</var>. It calls
<code>obstack_alloc_failed_handler</code> if allocation of memory by
<code>obstack_chunk_alloc</code> failed.
</p></dd></dl>
<dl>
<dt><a name="index-obstack_005fcopy0"></a>Function: <em>void *</em> <strong>obstack_copy0</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>address</var>, int <var>size</var>)</em></dt>
<dd><p>Like <code>obstack_copy</code>, but appends an extra byte containing a null
character. This extra byte is not counted in the argument <var>size</var>.
</p></dd></dl>
<p>The <code>obstack_copy0</code> function is convenient for copying a sequence
of characters into an obstack as a null-terminated string. Here is an
example of its use:
</p>
<div class="smallexample">
<pre class="smallexample">char *
obstack_savestring (char *addr, int size)
{
return obstack_copy0 (&amp;myobstack, addr, size);
}
</pre></div>
<p>Contrast this with the previous example of <code>savestring</code> using
<code>malloc</code> (see <a href="http://www.gnu.org/software/libc/manual/html_mono/libc.html#Basic-Allocation">Basic Allocation</a> in <cite>The GNU C Library Reference Manual</cite>).
</p>
<hr>
<a name="Freeing-Obstack-Objects"></a>
<div class="header">
<p>
Next: <a href="#Obstack-Functions" accesskey="n" rel="next">Obstack Functions</a>, Previous: <a href="#Allocation-in-an-Obstack" accesskey="p" rel="prev">Allocation in an Obstack</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Freeing-Objects-in-an-Obstack"></a>
<h4 class="subsubsection">2.3.1.4 Freeing Objects in an Obstack</h4>
<a name="index-freeing-_0028obstacks_0029"></a>
<p>To free an object allocated in an obstack, use the function
<code>obstack_free</code>. Since the obstack is a stack of objects, freeing
one object automatically frees all other objects allocated more recently
in the same obstack.
</p>
<dl>
<dt><a name="index-obstack_005ffree"></a>Function: <em>void</em> <strong>obstack_free</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>object</var>)</em></dt>
<dd><p>If <var>object</var> is a null pointer, everything allocated in the obstack
is freed. Otherwise, <var>object</var> must be the address of an object
allocated in the obstack. Then <var>object</var> is freed, along with
everything allocated in <var>obstack</var> since <var>object</var>.
</p></dd></dl>
<p>Note that if <var>object</var> is a null pointer, the result is an
uninitialized obstack. To free all memory in an obstack but leave it
valid for further allocation, call <code>obstack_free</code> with the address
of the first object allocated on the obstack:
</p>
<div class="smallexample">
<pre class="smallexample">obstack_free (obstack_ptr, first_object_allocated_ptr);
</pre></div>
<p>Recall that the objects in an obstack are grouped into chunks. When all
the objects in a chunk become free, the obstack library automatically
frees the chunk (see <a href="#Preparing-for-Obstacks">Preparing for Obstacks</a>). Then other
obstacks, or non-obstack allocation, can reuse the space of the chunk.
</p>
<hr>
<a name="Obstack-Functions"></a>
<div class="header">
<p>
Next: <a href="#Growing-Objects" accesskey="n" rel="next">Growing Objects</a>, Previous: <a href="#Freeing-Obstack-Objects" accesskey="p" rel="prev">Freeing Obstack Objects</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Obstack-Functions-and-Macros"></a>
<h4 class="subsubsection">2.3.1.5 Obstack Functions and Macros</h4>
<a name="index-macros"></a>
<p>The interfaces for using obstacks may be defined either as functions or
as macros, depending on the compiler. The obstack facility works with
all C compilers, including both ISO&nbsp;C<!-- /@w --> and traditional C, but there are
precautions you must take if you plan to use compilers other than GNU C.
</p>
<p>If you are using an old-fashioned <span class="nolinebreak">non-ISO</span>&nbsp;C<!-- /@w --> compiler, all the obstack
&ldquo;functions&rdquo; are actually defined only as macros. You can call these
macros like functions, but you cannot use them in any other way (for
example, you cannot take their address).
</p>
<p>Calling the macros requires a special precaution: namely, the first
operand (the obstack pointer) may not contain any side effects, because
it may be computed more than once. For example, if you write this:
</p>
<div class="smallexample">
<pre class="smallexample">obstack_alloc (get_obstack (), 4);
</pre></div>
<p>you will find that <code>get_obstack</code> may be called several times.
If you use <code>*obstack_list_ptr++</code> as the obstack pointer argument,
you will get very strange results since the incrementation may occur
several times.
</p>
<p>In ISO&nbsp;C<!-- /@w -->, each function has both a macro definition and a function
definition. The function definition is used if you take the address of the
function without calling it. An ordinary call uses the macro definition by
default, but you can request the function definition instead by writing the
function name in parentheses, as shown here:
</p>
<div class="smallexample">
<pre class="smallexample">char *x;
void *(*funcp) ();
/* <span class="roman">Use the macro</span>. */
x = (char *) obstack_alloc (obptr, size);
/* <span class="roman">Call the function</span>. */
x = (char *) (obstack_alloc) (obptr, size);
/* <span class="roman">Take the address of the function</span>. */
funcp = obstack_alloc;
</pre></div>
<p>This is the same situation that exists in ISO&nbsp;C<!-- /@w --> for the standard library
functions. See <a href="http://www.gnu.org/software/libc/manual/html_mono/libc.html#Macro-Definitions">Macro Definitions</a> in <cite>The GNU C Library Reference Manual</cite>.
</p>
<p><strong>Warning:</strong> When you do use the macros, you must observe the
precaution of avoiding side effects in the first operand, even in ISO&nbsp;C<!-- /@w -->.
</p>
<p>If you use the GNU C compiler, this precaution is not necessary, because
various language extensions in GNU C permit defining the macros so as to
compute each argument only once.
</p>
<hr>
<a name="Growing-Objects"></a>
<div class="header">
<p>
Next: <a href="#Extra-Fast-Growing" accesskey="n" rel="next">Extra Fast Growing</a>, Previous: <a href="#Obstack-Functions" accesskey="p" rel="prev">Obstack Functions</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Growing-Objects-1"></a>
<h4 class="subsubsection">2.3.1.6 Growing Objects</h4>
<a name="index-growing-objects-_0028in-obstacks_0029"></a>
<a name="index-changing-the-size-of-a-block-_0028obstacks_0029"></a>
<p>Because memory in obstack chunks is used sequentially, it is possible to
build up an object step by step, adding one or more bytes at a time to the
end of the object. With this technique, you do not need to know how much
data you will put in the object until you come to the end of it. We call
this the technique of <em>growing objects</em>. The special functions
for adding data to the growing object are described in this section.
</p>
<p>You don&rsquo;t need to do anything special when you start to grow an object.
Using one of the functions to add data to the object automatically
starts it. However, it is necessary to say explicitly when the object is
finished. This is done with the function <code>obstack_finish</code>.
</p>
<p>The actual address of the object thus built up is not known until the
object is finished. Until then, it always remains possible that you will
add so much data that the object must be copied into a new chunk.
</p>
<p>While the obstack is in use for a growing object, you cannot use it for
ordinary allocation of another object. If you try to do so, the space
already added to the growing object will become part of the other object.
</p>
<dl>
<dt><a name="index-obstack_005fblank"></a>Function: <em>void</em> <strong>obstack_blank</strong> <em>(struct obstack *<var>obstack-ptr</var>, int <var>size</var>)</em></dt>
<dd><p>The most basic function for adding to a growing object is
<code>obstack_blank</code>, which adds space without initializing it.
</p></dd></dl>
<dl>
<dt><a name="index-obstack_005fgrow"></a>Function: <em>void</em> <strong>obstack_grow</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>data</var>, int <var>size</var>)</em></dt>
<dd><p>To add a block of initialized space, use <code>obstack_grow</code>, which is
the growing-object analogue of <code>obstack_copy</code>. It adds <var>size</var>
bytes of data to the growing object, copying the contents from
<var>data</var>.
</p></dd></dl>
<dl>
<dt><a name="index-obstack_005fgrow0"></a>Function: <em>void</em> <strong>obstack_grow0</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>data</var>, int <var>size</var>)</em></dt>
<dd><p>This is the growing-object analogue of <code>obstack_copy0</code>. It adds
<var>size</var> bytes copied from <var>data</var>, followed by an additional null
character.
</p></dd></dl>
<dl>
<dt><a name="index-obstack_005f1grow"></a>Function: <em>void</em> <strong>obstack_1grow</strong> <em>(struct obstack *<var>obstack-ptr</var>, char <var>c</var>)</em></dt>
<dd><p>To add one character at a time, use the function <code>obstack_1grow</code>.
It adds a single byte containing <var>c</var> to the growing object.
</p></dd></dl>
<dl>
<dt><a name="index-obstack_005fptr_005fgrow"></a>Function: <em>void</em> <strong>obstack_ptr_grow</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>data</var>)</em></dt>
<dd><p>Adding the value of a pointer one can use the function
<code>obstack_ptr_grow</code>. It adds <code>sizeof (void *)</code> bytes
containing the value of <var>data</var>.
</p></dd></dl>
<dl>
<dt><a name="index-obstack_005fint_005fgrow"></a>Function: <em>void</em> <strong>obstack_int_grow</strong> <em>(struct obstack *<var>obstack-ptr</var>, int <var>data</var>)</em></dt>
<dd><p>A single value of type <code>int</code> can be added by using the
<code>obstack_int_grow</code> function. It adds <code>sizeof (int)</code> bytes to
the growing object and initializes them with the value of <var>data</var>.
</p></dd></dl>
<dl>
<dt><a name="index-obstack_005ffinish"></a>Function: <em>void *</em> <strong>obstack_finish</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
<dd><p>When you are finished growing the object, use the function
<code>obstack_finish</code> to close it off and return its final address.
</p>
<p>Once you have finished the object, the obstack is available for ordinary
allocation or for growing another object.
</p>
<p>This function can return a null pointer under the same conditions as
<code>obstack_alloc</code> (see <a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a>).
</p></dd></dl>
<p>When you build an object by growing it, you will probably need to know
afterward how long it became. You need not keep track of this as you grow
the object, because you can find out the length from the obstack just
before finishing the object with the function <code>obstack_object_size</code>,
declared as follows:
</p>
<dl>
<dt><a name="index-obstack_005fobject_005fsize"></a>Function: <em>int</em> <strong>obstack_object_size</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
<dd><p>This function returns the current size of the growing object, in bytes.
Remember to call this function <em>before</em> finishing the object.
After it is finished, <code>obstack_object_size</code> will return zero.
</p></dd></dl>
<p>If you have started growing an object and wish to cancel it, you should
finish it and then free it, like this:
</p>
<div class="smallexample">
<pre class="smallexample">obstack_free (obstack_ptr, obstack_finish (obstack_ptr));
</pre></div>
<p>This has no effect if no object was growing.
</p>
<a name="index-shrinking-objects"></a>
<p>You can use <code>obstack_blank</code> with a negative size argument to make
the current object smaller. Just don&rsquo;t try to shrink it beyond zero
length&mdash;there&rsquo;s no telling what will happen if you do that.
</p>
<hr>
<a name="Extra-Fast-Growing"></a>
<div class="header">
<p>
Next: <a href="#Status-of-an-Obstack" accesskey="n" rel="next">Status of an Obstack</a>, Previous: <a href="#Growing-Objects" accesskey="p" rel="prev">Growing Objects</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Extra-Fast-Growing-Objects"></a>
<h4 class="subsubsection">2.3.1.7 Extra Fast Growing Objects</h4>
<a name="index-efficiency-and-obstacks"></a>
<p>The usual functions for growing objects incur overhead for checking
whether there is room for the new growth in the current chunk. If you
are frequently constructing objects in small steps of growth, this
overhead can be significant.
</p>
<p>You can reduce the overhead by using special &ldquo;fast growth&rdquo;
functions that grow the object without checking. In order to have a
robust program, you must do the checking yourself. If you do this checking
in the simplest way each time you are about to add data to the object, you
have not saved anything, because that is what the ordinary growth
functions do. But if you can arrange to check less often, or check
more efficiently, then you make the program faster.
</p>
<p>The function <code>obstack_room</code> returns the amount of room available
in the current chunk. It is declared as follows:
</p>
<dl>
<dt><a name="index-obstack_005froom"></a>Function: <em>int</em> <strong>obstack_room</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
<dd><p>This returns the number of bytes that can be added safely to the current
growing object (or to an object about to be started) in obstack
<var>obstack</var> using the fast growth functions.
</p></dd></dl>
<p>While you know there is room, you can use these fast growth functions
for adding data to a growing object:
</p>
<dl>
<dt><a name="index-obstack_005f1grow_005ffast"></a>Function: <em>void</em> <strong>obstack_1grow_fast</strong> <em>(struct obstack *<var>obstack-ptr</var>, char <var>c</var>)</em></dt>
<dd><p>The function <code>obstack_1grow_fast</code> adds one byte containing the
character <var>c</var> to the growing object in obstack <var>obstack-ptr</var>.
</p></dd></dl>
<dl>
<dt><a name="index-obstack_005fptr_005fgrow_005ffast"></a>Function: <em>void</em> <strong>obstack_ptr_grow_fast</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>data</var>)</em></dt>
<dd><p>The function <code>obstack_ptr_grow_fast</code> adds <code>sizeof (void *)</code>
bytes containing the value of <var>data</var> to the growing object in
obstack <var>obstack-ptr</var>.
</p></dd></dl>
<dl>
<dt><a name="index-obstack_005fint_005fgrow_005ffast"></a>Function: <em>void</em> <strong>obstack_int_grow_fast</strong> <em>(struct obstack *<var>obstack-ptr</var>, int <var>data</var>)</em></dt>
<dd><p>The function <code>obstack_int_grow_fast</code> adds <code>sizeof (int)</code> bytes
containing the value of <var>data</var> to the growing object in obstack
<var>obstack-ptr</var>.
</p></dd></dl>
<dl>
<dt><a name="index-obstack_005fblank_005ffast"></a>Function: <em>void</em> <strong>obstack_blank_fast</strong> <em>(struct obstack *<var>obstack-ptr</var>, int <var>size</var>)</em></dt>
<dd><p>The function <code>obstack_blank_fast</code> adds <var>size</var> bytes to the
growing object in obstack <var>obstack-ptr</var> without initializing them.
</p></dd></dl>
<p>When you check for space using <code>obstack_room</code> and there is not
enough room for what you want to add, the fast growth functions
are not safe. In this case, simply use the corresponding ordinary
growth function instead. Very soon this will copy the object to a
new chunk; then there will be lots of room available again.
</p>
<p>So, each time you use an ordinary growth function, check afterward for
sufficient space using <code>obstack_room</code>. Once the object is copied
to a new chunk, there will be plenty of space again, so the program will
start using the fast growth functions again.
</p>
<p>Here is an example:
</p>
<div class="smallexample">
<pre class="smallexample">void
add_string (struct obstack *obstack, const char *ptr, int len)
{
while (len &gt; 0)
{
int room = obstack_room (obstack);
if (room == 0)
{
/* <span class="roman">Not enough room. Add one character slowly,</span>
<span class="roman">which may copy to a new chunk and make room.</span> */
obstack_1grow (obstack, *ptr++);
len--;
}
else
{
if (room &gt; len)
room = len;
/* <span class="roman">Add fast as much as we have room for.</span> */
len -= room;
while (room-- &gt; 0)
obstack_1grow_fast (obstack, *ptr++);
}
}
}
</pre></div>
<hr>
<a name="Status-of-an-Obstack"></a>
<div class="header">
<p>
Next: <a href="#Obstacks-Data-Alignment" accesskey="n" rel="next">Obstacks Data Alignment</a>, Previous: <a href="#Extra-Fast-Growing" accesskey="p" rel="prev">Extra Fast Growing</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Status-of-an-Obstack-1"></a>
<h4 class="subsubsection">2.3.1.8 Status of an Obstack</h4>
<a name="index-obstack-status"></a>
<a name="index-status-of-obstack"></a>
<p>Here are functions that provide information on the current status of
allocation in an obstack. You can use them to learn about an object while
still growing it.
</p>
<dl>
<dt><a name="index-obstack_005fbase"></a>Function: <em>void *</em> <strong>obstack_base</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
<dd><p>This function returns the tentative address of the beginning of the
currently growing object in <var>obstack-ptr</var>. If you finish the object
immediately, it will have that address. If you make it larger first, it
may outgrow the current chunk&mdash;then its address will change!
</p>
<p>If no object is growing, this value says where the next object you
allocate will start (once again assuming it fits in the current
chunk).
</p></dd></dl>
<dl>
<dt><a name="index-obstack_005fnext_005ffree"></a>Function: <em>void *</em> <strong>obstack_next_free</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
<dd><p>This function returns the address of the first free byte in the current
chunk of obstack <var>obstack-ptr</var>. This is the end of the currently
growing object. If no object is growing, <code>obstack_next_free</code>
returns the same value as <code>obstack_base</code>.
</p></dd></dl>
<dl>
<dt><a name="index-obstack_005fobject_005fsize-1"></a>Function: <em>int</em> <strong>obstack_object_size</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
<dd><p>This function returns the size in bytes of the currently growing object.
This is equivalent to
</p>
<div class="smallexample">
<pre class="smallexample">obstack_next_free (<var>obstack-ptr</var>) - obstack_base (<var>obstack-ptr</var>)
</pre></div>
</dd></dl>
<hr>
<a name="Obstacks-Data-Alignment"></a>
<div class="header">
<p>
Next: <a href="#Obstack-Chunks" accesskey="n" rel="next">Obstack Chunks</a>, Previous: <a href="#Status-of-an-Obstack" accesskey="p" rel="prev">Status of an Obstack</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Alignment-of-Data-in-Obstacks"></a>
<h4 class="subsubsection">2.3.1.9 Alignment of Data in Obstacks</h4>
<a name="index-alignment-_0028in-obstacks_0029"></a>
<p>Each obstack has an <em>alignment boundary</em>; each object allocated in
the obstack automatically starts on an address that is a multiple of the
specified boundary. By default, this boundary is aligned so that
the object can hold any type of data.
</p>
<p>To access an obstack&rsquo;s alignment boundary, use the macro
<code>obstack_alignment_mask</code>, whose function prototype looks like
this:
</p>
<dl>
<dt><a name="index-obstack_005falignment_005fmask"></a>Macro: <em>int</em> <strong>obstack_alignment_mask</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
<dd><p>The value is a bit mask; a bit that is 1 indicates that the corresponding
bit in the address of an object should be 0. The mask value should be one
less than a power of 2; the effect is that all object addresses are
multiples of that power of 2. The default value of the mask is a value
that allows aligned objects to hold any type of data: for example, if
its value is 3, any type of data can be stored at locations whose
addresses are multiples of 4. A mask value of 0 means an object can start
on any multiple of 1 (that is, no alignment is required).
</p>
<p>The expansion of the macro <code>obstack_alignment_mask</code> is an lvalue,
so you can alter the mask by assignment. For example, this statement:
</p>
<div class="smallexample">
<pre class="smallexample">obstack_alignment_mask (obstack_ptr) = 0;
</pre></div>
<p>has the effect of turning off alignment processing in the specified obstack.
</p></dd></dl>
<p>Note that a change in alignment mask does not take effect until
<em>after</em> the next time an object is allocated or finished in the
obstack. If you are not growing an object, you can make the new
alignment mask take effect immediately by calling <code>obstack_finish</code>.
This will finish a zero-length object and then do proper alignment for
the next object.
</p>
<hr>
<a name="Obstack-Chunks"></a>
<div class="header">
<p>
Next: <a href="#Summary-of-Obstacks" accesskey="n" rel="next">Summary of Obstacks</a>, Previous: <a href="#Obstacks-Data-Alignment" accesskey="p" rel="prev">Obstacks Data Alignment</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Obstack-Chunks-1"></a>
<h4 class="subsubsection">2.3.1.10 Obstack Chunks</h4>
<a name="index-efficiency-of-chunks"></a>
<a name="index-chunks"></a>
<p>Obstacks work by allocating space for themselves in large chunks, and
then parceling out space in the chunks to satisfy your requests. Chunks
are normally 4096 bytes long unless you specify a different chunk size.
The chunk size includes 8 bytes of overhead that are not actually used
for storing objects. Regardless of the specified size, longer chunks
will be allocated when necessary for long objects.
</p>
<p>The obstack library allocates chunks by calling the function
<code>obstack_chunk_alloc</code>, which you must define. When a chunk is no
longer needed because you have freed all the objects in it, the obstack
library frees the chunk by calling <code>obstack_chunk_free</code>, which you
must also define.
</p>
<p>These two must be defined (as macros) or declared (as functions) in each
source file that uses <code>obstack_init</code> (see <a href="#Creating-Obstacks">Creating Obstacks</a>).
Most often they are defined as macros like this:
</p>
<div class="smallexample">
<pre class="smallexample">#define obstack_chunk_alloc malloc
#define obstack_chunk_free free
</pre></div>
<p>Note that these are simple macros (no arguments). Macro definitions with
arguments will not work! It is necessary that <code>obstack_chunk_alloc</code>
or <code>obstack_chunk_free</code>, alone, expand into a function name if it is
not itself a function name.
</p>
<p>If you allocate chunks with <code>malloc</code>, the chunk size should be a
power of 2. The default chunk size, 4096, was chosen because it is long
enough to satisfy many typical requests on the obstack yet short enough
not to waste too much memory in the portion of the last chunk not yet used.
</p>
<dl>
<dt><a name="index-obstack_005fchunk_005fsize"></a>Macro: <em>int</em> <strong>obstack_chunk_size</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
<dd><p>This returns the chunk size of the given obstack.
</p></dd></dl>
<p>Since this macro expands to an lvalue, you can specify a new chunk size by
assigning it a new value. Doing so does not affect the chunks already
allocated, but will change the size of chunks allocated for that particular
obstack in the future. It is unlikely to be useful to make the chunk size
smaller, but making it larger might improve efficiency if you are
allocating many objects whose size is comparable to the chunk size. Here
is how to do so cleanly:
</p>
<div class="smallexample">
<pre class="smallexample">if (obstack_chunk_size (obstack_ptr) &lt; <var>new-chunk-size</var>)
obstack_chunk_size (obstack_ptr) = <var>new-chunk-size</var>;
</pre></div>
<hr>
<a name="Summary-of-Obstacks"></a>
<div class="header">
<p>
Previous: <a href="#Obstack-Chunks" accesskey="p" rel="prev">Obstack Chunks</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Summary-of-Obstack-Functions"></a>
<h4 class="subsubsection">2.3.1.11 Summary of Obstack Functions</h4>
<p>Here is a summary of all the functions associated with obstacks. Each
takes the address of an obstack (<code>struct obstack *</code>) as its first
argument.
</p>
<dl compact="compact">
<dt><code>void obstack_init (struct obstack *<var>obstack-ptr</var>)</code></dt>
<dd><p>Initialize use of an obstack. See <a href="#Creating-Obstacks">Creating Obstacks</a>.
</p>
</dd>
<dt><code>void *obstack_alloc (struct obstack *<var>obstack-ptr</var>, int <var>size</var>)</code></dt>
<dd><p>Allocate an object of <var>size</var> uninitialized bytes.
See <a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a>.
</p>
</dd>
<dt><code>void *obstack_copy (struct obstack *<var>obstack-ptr</var>, void *<var>address</var>, int <var>size</var>)</code></dt>
<dd><p>Allocate an object of <var>size</var> bytes, with contents copied from
<var>address</var>. See <a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a>.
</p>
</dd>
<dt><code>void *obstack_copy0 (struct obstack *<var>obstack-ptr</var>, void *<var>address</var>, int <var>size</var>)</code></dt>
<dd><p>Allocate an object of <var>size</var>+1 bytes, with <var>size</var> of them copied
from <var>address</var>, followed by a null character at the end.
See <a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a>.
</p>
</dd>
<dt><code>void obstack_free (struct obstack *<var>obstack-ptr</var>, void *<var>object</var>)</code></dt>
<dd><p>Free <var>object</var> (and everything allocated in the specified obstack
more recently than <var>object</var>). See <a href="#Freeing-Obstack-Objects">Freeing Obstack Objects</a>.
</p>
</dd>
<dt><code>void obstack_blank (struct obstack *<var>obstack-ptr</var>, int <var>size</var>)</code></dt>
<dd><p>Add <var>size</var> uninitialized bytes to a growing object.
See <a href="#Growing-Objects">Growing Objects</a>.
</p>
</dd>
<dt><code>void obstack_grow (struct obstack *<var>obstack-ptr</var>, void *<var>address</var>, int <var>size</var>)</code></dt>
<dd><p>Add <var>size</var> bytes, copied from <var>address</var>, to a growing object.
See <a href="#Growing-Objects">Growing Objects</a>.
</p>
</dd>
<dt><code>void obstack_grow0 (struct obstack *<var>obstack-ptr</var>, void *<var>address</var>, int <var>size</var>)</code></dt>
<dd><p>Add <var>size</var> bytes, copied from <var>address</var>, to a growing object,
and then add another byte containing a null character. See <a href="#Growing-Objects">Growing Objects</a>.
</p>
</dd>
<dt><code>void obstack_1grow (struct obstack *<var>obstack-ptr</var>, char <var>data-char</var>)</code></dt>
<dd><p>Add one byte containing <var>data-char</var> to a growing object.
See <a href="#Growing-Objects">Growing Objects</a>.
</p>
</dd>
<dt><code>void *obstack_finish (struct obstack *<var>obstack-ptr</var>)</code></dt>
<dd><p>Finalize the object that is growing and return its permanent address.
See <a href="#Growing-Objects">Growing Objects</a>.
</p>
</dd>
<dt><code>int obstack_object_size (struct obstack *<var>obstack-ptr</var>)</code></dt>
<dd><p>Get the current size of the currently growing object. See <a href="#Growing-Objects">Growing Objects</a>.
</p>
</dd>
<dt><code>void obstack_blank_fast (struct obstack *<var>obstack-ptr</var>, int <var>size</var>)</code></dt>
<dd><p>Add <var>size</var> uninitialized bytes to a growing object without checking
that there is enough room. See <a href="#Extra-Fast-Growing">Extra Fast Growing</a>.
</p>
</dd>
<dt><code>void obstack_1grow_fast (struct obstack *<var>obstack-ptr</var>, char <var>data-char</var>)</code></dt>
<dd><p>Add one byte containing <var>data-char</var> to a growing object without
checking that there is enough room. See <a href="#Extra-Fast-Growing">Extra Fast Growing</a>.
</p>
</dd>
<dt><code>int obstack_room (struct obstack *<var>obstack-ptr</var>)</code></dt>
<dd><p>Get the amount of room now available for growing the current object.
See <a href="#Extra-Fast-Growing">Extra Fast Growing</a>.
</p>
</dd>
<dt><code>int obstack_alignment_mask (struct obstack *<var>obstack-ptr</var>)</code></dt>
<dd><p>The mask used for aligning the beginning of an object. This is an
lvalue. See <a href="#Obstacks-Data-Alignment">Obstacks Data Alignment</a>.
</p>
</dd>
<dt><code>int obstack_chunk_size (struct obstack *<var>obstack-ptr</var>)</code></dt>
<dd><p>The size for allocating chunks. This is an lvalue. See <a href="#Obstack-Chunks">Obstack Chunks</a>.
</p>
</dd>
<dt><code>void *obstack_base (struct obstack *<var>obstack-ptr</var>)</code></dt>
<dd><p>Tentative starting address of the currently growing object.
See <a href="#Status-of-an-Obstack">Status of an Obstack</a>.
</p>
</dd>
<dt><code>void *obstack_next_free (struct obstack *<var>obstack-ptr</var>)</code></dt>
<dd><p>Address just after the end of the currently growing object.
See <a href="#Status-of-an-Obstack">Status of an Obstack</a>.
</p></dd>
</dl>
<hr>
<a name="Functions"></a>
<div class="header">
<p>
Next: <a href="#Licenses" accesskey="n" rel="next">Licenses</a>, Previous: <a href="#Overview" accesskey="p" rel="prev">Overview</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Function_002c-Variable_002c-and-Macro-Listing_002e"></a>
<h2 class="chapter">3 Function, Variable, and Macro Listing.</h2>
<dl>
<dt><a name="index-alloca"></a>Replacement: <em>void*</em> <strong>alloca</strong> <em>(size_t <var>size</var>)</em></dt>
<dd>
<p>This function allocates memory which will be automatically reclaimed
after the procedure exits. The <code>libiberty</code> implementation does not free
the memory immediately but will do so eventually during subsequent
calls to this function. Memory is allocated using <code>xmalloc</code> under
normal circumstances.
</p>
<p>The header file <samp>alloca-conf.h</samp> can be used in conjunction with the
GNU Autoconf test <code>AC_FUNC_ALLOCA</code> to test for and properly make
available this function. The <code>AC_FUNC_ALLOCA</code> test requires that
client code use a block of preprocessor code to be safe (see the Autoconf
manual for more); this header incorporates that logic and more, including
the possibility of a GCC built-in function.
</p>
</dd></dl>
<dl>
<dt><a name="index-asprintf"></a>Extension: <em>int</em> <strong>asprintf</strong> <em>(char **<var>resptr</var>, const char *<var>format</var>, ...)</em></dt>
<dd>
<p>Like <code>sprintf</code>, but instead of passing a pointer to a buffer, you
pass a pointer to a pointer. This function will compute the size of
the buffer needed, allocate memory with <code>malloc</code>, and store a
pointer to the allocated memory in <code>*<var>resptr</var></code>. The value
returned is the same as <code>sprintf</code> would return. If memory could
not be allocated, minus one is returned and <code>NULL</code> is stored in
<code>*<var>resptr</var></code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-atexit"></a>Supplemental: <em>int</em> <strong>atexit</strong> <em>(void (*<var>f</var>)())</em></dt>
<dd>
<p>Causes function <var>f</var> to be called at exit. Returns 0.
</p>
</dd></dl>
<dl>
<dt><a name="index-basename"></a>Supplemental: <em>char*</em> <strong>basename</strong> <em>(const char *<var>name</var>)</em></dt>
<dd>
<p>Returns a pointer to the last component of pathname <var>name</var>.
Behavior is undefined if the pathname ends in a directory separator.
</p>
</dd></dl>
<dl>
<dt><a name="index-bcmp"></a>Supplemental: <em>int</em> <strong>bcmp</strong> <em>(char *<var>x</var>, char *<var>y</var>, int <var>count</var>)</em></dt>
<dd>
<p>Compares the first <var>count</var> bytes of two areas of memory. Returns
zero if they are the same, nonzero otherwise. Returns zero if
<var>count</var> is zero. A nonzero result only indicates a difference,
it does not indicate any sorting order (say, by having a positive
result mean <var>x</var> sorts before <var>y</var>).
</p>
</dd></dl>
<dl>
<dt><a name="index-bcopy"></a>Supplemental: <em>void</em> <strong>bcopy</strong> <em>(char *<var>in</var>, char *<var>out</var>, int <var>length</var>)</em></dt>
<dd>
<p>Copies <var>length</var> bytes from memory region <var>in</var> to region
<var>out</var>. The use of <code>bcopy</code> is deprecated in new programs.
</p>
</dd></dl>
<dl>
<dt><a name="index-bsearch"></a>Supplemental: <em>void*</em> <strong>bsearch</strong> <em>(const void *<var>key</var>, const void *<var>base</var>, size_t <var>nmemb</var>, size_t <var>size</var>, int (*<var>compar</var>)(const void *, const void *))</em></dt>
<dd>
<p>Performs a search over an array of <var>nmemb</var> elements pointed to by
<var>base</var> for a member that matches the object pointed to by <var>key</var>.
The size of each member is specified by <var>size</var>. The array contents
should be sorted in ascending order according to the <var>compar</var>
comparison function. This routine should take two arguments pointing to
the <var>key</var> and to an array member, in that order, and should return an
integer less than, equal to, or greater than zero if the <var>key</var> object
is respectively less than, matching, or greater than the array member.
</p>
</dd></dl>
<dl>
<dt><a name="index-buildargv"></a>Extension: <em>char**</em> <strong>buildargv</strong> <em>(char *<var>sp</var>)</em></dt>
<dd>
<p>Given a pointer to a string, parse the string extracting fields
separated by whitespace and optionally enclosed within either single
or double quotes (which are stripped off), and build a vector of
pointers to copies of the string for each field. The input string
remains unchanged. The last element of the vector is followed by a
<code>NULL</code> element.
</p>
<p>All of the memory for the pointer array and copies of the string
is obtained from <code>xmalloc</code>. All of the memory can be returned to the
system with the single function call <code>freeargv</code>, which takes the
returned result of <code>buildargv</code>, as it&rsquo;s argument.
</p>
<p>Returns a pointer to the argument vector if successful. Returns
<code>NULL</code> if <var>sp</var> is <code>NULL</code> or if there is insufficient
memory to complete building the argument vector.
</p>
<p>If the input is a null string (as opposed to a <code>NULL</code> pointer),
then buildarg returns an argument vector that has one arg, a null
string.
</p>
</dd></dl>
<dl>
<dt><a name="index-bzero"></a>Supplemental: <em>void</em> <strong>bzero</strong> <em>(char *<var>mem</var>, int <var>count</var>)</em></dt>
<dd>
<p>Zeros <var>count</var> bytes starting at <var>mem</var>. Use of this function
is deprecated in favor of <code>memset</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-calloc"></a>Supplemental: <em>void*</em> <strong>calloc</strong> <em>(size_t <var>nelem</var>, size_t <var>elsize</var>)</em></dt>
<dd>
<p>Uses <code>malloc</code> to allocate storage for <var>nelem</var> objects of
<var>elsize</var> bytes each, then zeros the memory.
</p>
</dd></dl>
<dl>
<dt><a name="index-canonical_005ffilename_005feq"></a>Extension: <em>int</em> <strong>canonical_filename_eq</strong> <em>(const char *<var>a</var>, const char *<var>b</var>)</em></dt>
<dd>
<p>Return non-zero if file names <var>a</var> and <var>b</var> are equivalent.
This function compares the canonical versions of the filenames as returned by
<code>lrealpath()</code>, so that so that different file names pointing to the same
underlying file are treated as being identical.
</p>
</dd></dl>
<dl>
<dt><a name="index-choose_005ftemp_005fbase"></a>Extension: <em>char*</em> <strong>choose_temp_base</strong> <em>(void)</em></dt>
<dd>
<p>Return a prefix for temporary file names or <code>NULL</code> if unable to
find one. The current directory is chosen if all else fails so the
program is exited if a temporary directory can&rsquo;t be found (<code>mktemp</code>
fails). The buffer for the result is obtained with <code>xmalloc</code>.
</p>
<p>This function is provided for backwards compatibility only. Its use is
not recommended.
</p>
</dd></dl>
<dl>
<dt><a name="index-char_002a"></a>Replacement: <em>const</em> <strong>char*</strong> <em>choose_tmpdir ()</em></dt>
<dd>
<p>Returns a pointer to a directory path suitable for creating temporary
files in.
</p>
</dd></dl>
<dl>
<dt><a name="index-clock"></a>Supplemental: <em>long</em> <strong>clock</strong> <em>(void)</em></dt>
<dd>
<p>Returns an approximation of the CPU time used by the process as a
<code>clock_t</code>; divide this number by &lsquo;<samp>CLOCKS_PER_SEC</samp>&rsquo; to get the
number of seconds used.
</p>
</dd></dl>
<dl>
<dt><a name="index-concat"></a>Extension: <em>char*</em> <strong>concat</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>, &hellip;, <code>NULL</code>)</em></dt>
<dd>
<p>Concatenate zero or more of strings and return the result in freshly
<code>xmalloc</code>ed memory. The argument list is terminated by the first
<code>NULL</code> pointer encountered. Pointers to empty strings are ignored.
</p>
</dd></dl>
<dl>
<dt><a name="index-countargv"></a>Extension: <em>int</em> <strong>countargv</strong> <em>(char **<var>argv</var>)</em></dt>
<dd>
<p>Return the number of elements in <var>argv</var>.
Returns zero if <var>argv</var> is NULL.
</p>
</dd></dl>
<dl>
<dt><a name="index-crc32"></a>Extension: <em>unsigned int</em> <strong>crc32</strong> <em>(const unsigned char *<var>buf</var>, int <var>len</var>, unsigned int <var>init</var>)</em></dt>
<dd>
<p>Compute the 32-bit CRC of <var>buf</var> which has length <var>len</var>. The
starting value is <var>init</var>; this may be used to compute the CRC of
data split across multiple buffers by passing the return value of each
call as the <var>init</var> parameter of the next.
</p>
<p>This is intended to match the CRC used by the <code>gdb</code> remote
protocol for the &lsquo;<samp>qCRC</samp>&rsquo; command. In order to get the same
results as gdb for a block of data, you must pass the first CRC
parameter as <code>0xffffffff</code>.
</p>
<p>This CRC can be specified as:
</p>
<p>Width : 32
Poly : 0x04c11db7
Init : parameter, typically 0xffffffff
RefIn : false
RefOut : false
XorOut : 0
</p>
<p>This differs from the &quot;standard&quot; CRC-32 algorithm in that the values
are not reflected, and there is no final XOR value. These differences
make it easy to compose the values of multiple blocks.
</p>
</dd></dl>
<dl>
<dt><a name="index-dupargv"></a>Extension: <em>char**</em> <strong>dupargv</strong> <em>(char **<var>vector</var>)</em></dt>
<dd>
<p>Duplicate an argument vector. Simply scans through <var>vector</var>,
duplicating each argument until the terminating <code>NULL</code> is found.
Returns a pointer to the argument vector if successful. Returns
<code>NULL</code> if there is insufficient memory to complete building the
argument vector.
</p>
</dd></dl>
<dl>
<dt><a name="index-errno_005fmax"></a>Extension: <em>int</em> <strong>errno_max</strong> <em>(void)</em></dt>
<dd>
<p>Returns the maximum <code>errno</code> value for which a corresponding
symbolic name or message is available. Note that in the case where we
use the <code>sys_errlist</code> supplied by the system, it is possible for
there to be more symbolic names than messages, or vice versa. In
fact, the manual page for <code>perror(3C)</code> explicitly warns that one
should check the size of the table (<code>sys_nerr</code>) before indexing
it, since new error codes may be added to the system before they are
added to the table. Thus <code>sys_nerr</code> might be smaller than value
implied by the largest <code>errno</code> value defined in <code>&lt;errno.h&gt;</code>.
</p>
<p>We return the maximum value that can be used to obtain a meaningful
symbolic name or message.
</p>
</dd></dl>
<dl>
<dt><a name="index-expandargv"></a>Extension: <em>void</em> <strong>expandargv</strong> <em>(int *<var>argcp</var>, char ***<var>argvp</var>)</em></dt>
<dd>
<p>The <var>argcp</var> and <code>argvp</code> arguments are pointers to the usual
<code>argc</code> and <code>argv</code> arguments to <code>main</code>. This function
looks for arguments that begin with the character &lsquo;<samp>@</samp>&rsquo;. Any such
arguments are interpreted as &ldquo;response files&rdquo;. The contents of the
response file are interpreted as additional command line options. In
particular, the file is separated into whitespace-separated strings;
each such string is taken as a command-line option. The new options
are inserted in place of the option naming the response file, and
<code>*argcp</code> and <code>*argvp</code> will be updated. If the value of
<code>*argvp</code> is modified by this function, then the new value has
been dynamically allocated and can be deallocated by the caller with
<code>freeargv</code>. However, most callers will simply call
<code>expandargv</code> near the beginning of <code>main</code> and allow the
operating system to free the memory when the program exits.
</p>
</dd></dl>
<dl>
<dt><a name="index-fdmatch"></a>Extension: <em>int</em> <strong>fdmatch</strong> <em>(int <var>fd1</var>, int <var>fd2</var>)</em></dt>
<dd>
<p>Check to see if two open file descriptors refer to the same file.
This is useful, for example, when we have an open file descriptor for
an unnamed file, and the name of a file that we believe to correspond
to that fd. This can happen when we are exec&rsquo;d with an already open
file (<code>stdout</code> for example) or from the SVR4 <samp>/proc</samp> calls
that return open file descriptors for mapped address spaces. All we
have to do is open the file by name and check the two file descriptors
for a match, which is done by comparing major and minor device numbers
and inode numbers.
</p>
</dd></dl>
<dl>
<dt><a name="index-fdopen_005funlocked"></a>Extension: <em>FILE *</em> <strong>fdopen_unlocked</strong> <em>(int <var>fildes</var>, const char * <var>mode</var>)</em></dt>
<dd>
<p>Opens and returns a <code>FILE</code> pointer via <code>fdopen</code>. If the
operating system supports it, ensure that the stream is setup to avoid
any multi-threaded locking. Otherwise return the <code>FILE</code> pointer
unchanged.
</p>
</dd></dl>
<dl>
<dt><a name="index-ffs"></a>Supplemental: <em>int</em> <strong>ffs</strong> <em>(int <var>valu</var>)</em></dt>
<dd>
<p>Find the first (least significant) bit set in <var>valu</var>. Bits are
numbered from right to left, starting with bit 1 (corresponding to the
value 1). If <var>valu</var> is zero, zero is returned.
</p>
</dd></dl>
<dl>
<dt><a name="index-filename_005fcmp"></a>Extension: <em>int</em> <strong>filename_cmp</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>)</em></dt>
<dd>
<p>Return zero if the two file names <var>s1</var> and <var>s2</var> are equivalent.
If not equivalent, the returned value is similar to what <code>strcmp</code>
would return. In other words, it returns a negative value if <var>s1</var>
is less than <var>s2</var>, or a positive value if <var>s2</var> is greater than
<var>s2</var>.
</p>
<p>This function does not normalize file names. As a result, this function
will treat filenames that are spelled differently as different even in
the case when the two filenames point to the same underlying file.
However, it does handle the fact that on DOS-like file systems, forward
and backward slashes are equal.
</p>
</dd></dl>
<dl>
<dt><a name="index-filename_005feq"></a>Extension: <em>int</em> <strong>filename_eq</strong> <em>(const void *<var>s1</var>, const void *<var>s2</var>)</em></dt>
<dd>
<p>Return non-zero if file names <var>s1</var> and <var>s2</var> are equivalent.
This function is for use with hashtab.c hash tables.
</p>
</dd></dl>
<dl>
<dt><a name="index-filename_005fhash"></a>Extension: <em>hashval_t</em> <strong>filename_hash</strong> <em>(const void *<var>s</var>)</em></dt>
<dd>
<p>Return the hash value for file name <var>s</var> that will be compared
using filename_cmp.
This function is for use with hashtab.c hash tables.
</p>
</dd></dl>
<dl>
<dt><a name="index-filename_005fncmp"></a>Extension: <em>int</em> <strong>filename_ncmp</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>, size_t <var>n</var>)</em></dt>
<dd>
<p>Return zero if the two file names <var>s1</var> and <var>s2</var> are equivalent
in range <var>n</var>.
If not equivalent, the returned value is similar to what <code>strncmp</code>
would return. In other words, it returns a negative value if <var>s1</var>
is less than <var>s2</var>, or a positive value if <var>s2</var> is greater than
<var>s2</var>.
</p>
<p>This function does not normalize file names. As a result, this function
will treat filenames that are spelled differently as different even in
the case when the two filenames point to the same underlying file.
However, it does handle the fact that on DOS-like file systems, forward
and backward slashes are equal.
</p>
</dd></dl>
<dl>
<dt><a name="index-fnmatch"></a>Replacement: <em>int</em> <strong>fnmatch</strong> <em>(const char *<var>pattern</var>, const char *<var>string</var>, int <var>flags</var>)</em></dt>
<dd>
<p>Matches <var>string</var> against <var>pattern</var>, returning zero if it
matches, <code>FNM_NOMATCH</code> if not. <var>pattern</var> may contain the
wildcards <code>?</code> to match any one character, <code>*</code> to match any
zero or more characters, or a set of alternate characters in square
brackets, like &lsquo;<samp>[a-gt8]</samp>&rsquo;, which match one character (<code>a</code>
through <code>g</code>, or <code>t</code>, or <code>8</code>, in this example) if that one
character is in the set. A set may be inverted (i.e., match anything
except what&rsquo;s in the set) by giving <code>^</code> or <code>!</code> as the first
character in the set. To include those characters in the set, list them
as anything other than the first character of the set. To include a
dash in the set, list it last in the set. A backslash character makes
the following character not special, so for example you could match
against a literal asterisk with &lsquo;<samp>\*</samp>&rsquo;. To match a literal
backslash, use &lsquo;<samp>\\</samp>&rsquo;.
</p>
<p><code>flags</code> controls various aspects of the matching process, and is a
boolean OR of zero or more of the following values (defined in
<code>&lt;fnmatch.h&gt;</code>):
</p>
<dl compact="compact">
<dt><code>FNM_PATHNAME</code></dt>
<dt><code>FNM_FILE_NAME</code></dt>
<dd><p><var>string</var> is assumed to be a path name. No wildcard will ever match
<code>/</code>.
</p>
</dd>
<dt><code>FNM_NOESCAPE</code></dt>
<dd><p>Do not interpret backslashes as quoting the following special character.
</p>
</dd>
<dt><code>FNM_PERIOD</code></dt>
<dd><p>A leading period (at the beginning of <var>string</var>, or if
<code>FNM_PATHNAME</code> after a slash) is not matched by <code>*</code> or
<code>?</code> but must be matched explicitly.
</p>
</dd>
<dt><code>FNM_LEADING_DIR</code></dt>
<dd><p>Means that <var>string</var> also matches <var>pattern</var> if some initial part
of <var>string</var> matches, and is followed by <code>/</code> and zero or more
characters. For example, &lsquo;<samp>foo*</samp>&rsquo; would match either &lsquo;<samp>foobar</samp>&rsquo;
or &lsquo;<samp>foobar/grill</samp>&rsquo;.
</p>
</dd>
<dt><code>FNM_CASEFOLD</code></dt>
<dd><p>Ignores case when performing the comparison.
</p>
</dd>
</dl>
</dd></dl>
<dl>
<dt><a name="index-fopen_005funlocked"></a>Extension: <em>FILE *</em> <strong>fopen_unlocked</strong> <em>(const char *<var>path</var>, const char * <var>mode</var>)</em></dt>
<dd>
<p>Opens and returns a <code>FILE</code> pointer via <code>fopen</code>. If the
operating system supports it, ensure that the stream is setup to avoid
any multi-threaded locking. Otherwise return the <code>FILE</code> pointer
unchanged.
</p>
</dd></dl>
<dl>
<dt><a name="index-freeargv"></a>Extension: <em>void</em> <strong>freeargv</strong> <em>(char **<var>vector</var>)</em></dt>
<dd>
<p>Free an argument vector that was built using <code>buildargv</code>. Simply
scans through <var>vector</var>, freeing the memory for each argument until
the terminating <code>NULL</code> is found, and then frees <var>vector</var>
itself.
</p>
</dd></dl>
<dl>
<dt><a name="index-freopen_005funlocked"></a>Extension: <em>FILE *</em> <strong>freopen_unlocked</strong> <em>(const char * <var>path</var>, const char * <var>mode</var>, FILE * <var>stream</var>)</em></dt>
<dd>
<p>Opens and returns a <code>FILE</code> pointer via <code>freopen</code>. If the
operating system supports it, ensure that the stream is setup to avoid
any multi-threaded locking. Otherwise return the <code>FILE</code> pointer
unchanged.
</p>
</dd></dl>
<dl>
<dt><a name="index-get_005frun_005ftime"></a>Replacement: <em>long</em> <strong>get_run_time</strong> <em>(void)</em></dt>
<dd>
<p>Returns the time used so far, in microseconds. If possible, this is
the time used by this process, else it is the elapsed time since the
process started.
</p>
</dd></dl>
<dl>
<dt><a name="index-getcwd"></a>Supplemental: <em>char*</em> <strong>getcwd</strong> <em>(char *<var>pathname</var>, int <var>len</var>)</em></dt>
<dd>
<p>Copy the absolute pathname for the current working directory into
<var>pathname</var>, which is assumed to point to a buffer of at least
<var>len</var> bytes, and return a pointer to the buffer. If the current
directory&rsquo;s path doesn&rsquo;t fit in <var>len</var> characters, the result is
<code>NULL</code> and <code>errno</code> is set. If <var>pathname</var> is a null pointer,
<code>getcwd</code> will obtain <var>len</var> bytes of space using
<code>malloc</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-getpagesize"></a>Supplemental: <em>int</em> <strong>getpagesize</strong> <em>(void)</em></dt>
<dd>
<p>Returns the number of bytes in a page of memory. This is the
granularity of many of the system memory management routines. No
guarantee is made as to whether or not it is the same as the basic
memory management hardware page size.
</p>
</dd></dl>
<dl>
<dt><a name="index-getpwd"></a>Supplemental: <em>char*</em> <strong>getpwd</strong> <em>(void)</em></dt>
<dd>
<p>Returns the current working directory. This implementation caches the
result on the assumption that the process will not call <code>chdir</code>
between calls to <code>getpwd</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-gettimeofday"></a>Supplemental: <em>int</em> <strong>gettimeofday</strong> <em>(struct timeval *<var>tp</var>, void *<var>tz</var>)</em></dt>
<dd>
<p>Writes the current time to <var>tp</var>. This implementation requires
that <var>tz</var> be NULL. Returns 0 on success, -1 on failure.
</p>
</dd></dl>
<dl>
<dt><a name="index-hex_005finit"></a>Extension: <em>void</em> <strong>hex_init</strong> <em>(void)</em></dt>
<dd>
<p>Initializes the array mapping the current character set to
corresponding hex values. This function must be called before any
call to <code>hex_p</code> or <code>hex_value</code>. If you fail to call it, a
default ASCII-based table will normally be used on ASCII systems.
</p>
</dd></dl>
<dl>
<dt><a name="index-hex_005fp"></a>Extension: <em>int</em> <strong>hex_p</strong> <em>(int <var>c</var>)</em></dt>
<dd>
<p>Evaluates to non-zero if the given character is a valid hex character,
or zero if it is not. Note that the value you pass will be cast to
<code>unsigned char</code> within the macro.
</p>
</dd></dl>
<dl>
<dt><a name="index-hex_005fvalue"></a>Extension: <em>unsigned int</em> <strong>hex_value</strong> <em>(int <var>c</var>)</em></dt>
<dd>
<p>Returns the numeric equivalent of the given character when interpreted
as a hexadecimal digit. The result is undefined if you pass an
invalid hex digit. Note that the value you pass will be cast to
<code>unsigned char</code> within the macro.
</p>
<p>The <code>hex_value</code> macro returns <code>unsigned int</code>, rather than
signed <code>int</code>, to make it easier to use in parsing addresses from
hex dump files: a signed <code>int</code> would be sign-extended when
converted to a wider unsigned type &mdash; like <code>bfd_vma</code>, on some
systems.
</p>
</dd></dl>
<dl>
<dt><a name="index-HOST_005fCHARSET"></a>Extension: <strong>HOST_CHARSET</strong></dt>
<dd><p>This macro indicates the basic character set and encoding used by the
host: more precisely, the encoding used for character constants in
preprocessor &lsquo;<samp>#if</samp>&rsquo; statements (the C &quot;execution character set&quot;).
It is defined by <samp>safe-ctype.h</samp>, and will be an integer constant
with one of the following values:
</p>
<dl compact="compact">
<dt><code>HOST_CHARSET_UNKNOWN</code>
<a name="index-HOST_005fCHARSET_005fUNKNOWN"></a>
</dt>
<dd><p>The host character set is unknown - that is, not one of the next two
possibilities.
</p>
</dd>
<dt><code>HOST_CHARSET_ASCII</code>
<a name="index-HOST_005fCHARSET_005fASCII"></a>
</dt>
<dd><p>The host character set is ASCII.
</p>
</dd>
<dt><code>HOST_CHARSET_EBCDIC</code>
<a name="index-HOST_005fCHARSET_005fEBCDIC"></a>
</dt>
<dd><p>The host character set is some variant of EBCDIC. (Only one of the
nineteen EBCDIC varying characters is tested; exercise caution.)
</p></dd>
</dl>
</dd></dl>
<dl>
<dt><a name="index-htab_005fcreate_005ftyped_005falloc"></a>Supplemental: <em>htab_t</em> <strong>htab_create_typed_alloc</strong> <em>(size_t <var>size</var>, htab_hash <var>hash_f</var>, htab_eq <var>eq_f</var>, htab_del <var>del_f</var>, htab_alloc <var>alloc_tab_f</var>, htab_alloc <var>alloc_f</var>, htab_free <var>free_f</var>)</em></dt>
<dd>
<p>This function creates a hash table that uses two different allocators
<var>alloc_tab_f</var> and <var>alloc_f</var> to use for allocating the table itself
and its entries respectively. This is useful when variables of different
types need to be allocated with different allocators.
</p>
<p>The created hash table is slightly larger than <var>size</var> and it is
initially empty (all the hash table entries are <code>HTAB_EMPTY_ENTRY</code>).
The function returns the created hash table, or <code>NULL</code> if memory
allocation fails.
</p>
</dd></dl>
<dl>
<dt><a name="index-index"></a>Supplemental: <em>char*</em> <strong>index</strong> <em>(char *<var>s</var>, int <var>c</var>)</em></dt>
<dd>
<p>Returns a pointer to the first occurrence of the character <var>c</var> in
the string <var>s</var>, or <code>NULL</code> if not found. The use of <code>index</code> is
deprecated in new programs in favor of <code>strchr</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-insque"></a>Supplemental: <em>void</em> <strong>insque</strong> <em>(struct qelem *<var>elem</var>, struct qelem *<var>pred</var>)</em></dt>
<dt><a name="index-remque"></a>Supplemental: <em>void</em> <strong>remque</strong> <em>(struct qelem *<var>elem</var>)</em></dt>
<dd>
<p>Routines to manipulate queues built from doubly linked lists. The
<code>insque</code> routine inserts <var>elem</var> in the queue immediately
after <var>pred</var>. The <code>remque</code> routine removes <var>elem</var> from
its containing queue. These routines expect to be passed pointers to
structures which have as their first members a forward pointer and a
back pointer, like this prototype (although no prototype is provided):
</p>
<div class="example">
<pre class="example">struct qelem {
struct qelem *q_forw;
struct qelem *q_back;
char q_data[];
};
</pre></div>
</dd></dl>
<dl>
<dt><a name="index-ISALPHA"></a>Extension: <strong>ISALPHA</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-ISALNUM"></a>Extension: <strong>ISALNUM</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-ISBLANK"></a>Extension: <strong>ISBLANK</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-ISCNTRL"></a>Extension: <strong>ISCNTRL</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-ISDIGIT"></a>Extension: <strong>ISDIGIT</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-ISGRAPH"></a>Extension: <strong>ISGRAPH</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-ISLOWER"></a>Extension: <strong>ISLOWER</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-ISPRINT"></a>Extension: <strong>ISPRINT</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-ISPUNCT"></a>Extension: <strong>ISPUNCT</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-ISSPACE"></a>Extension: <strong>ISSPACE</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-ISUPPER"></a>Extension: <strong>ISUPPER</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-ISXDIGIT"></a>Extension: <strong>ISXDIGIT</strong> <em>(<var>c</var>)</em></dt>
<dd>
<p>These twelve macros are defined by <samp>safe-ctype.h</samp>. Each has the
same meaning as the corresponding macro (with name in lowercase)
defined by the standard header <samp>ctype.h</samp>. For example,
<code>ISALPHA</code> returns true for alphabetic characters and false for
others. However, there are two differences between these macros and
those provided by <samp>ctype.h</samp>:
</p>
<ul>
<li> These macros are guaranteed to have well-defined behavior for all
values representable by <code>signed char</code> and <code>unsigned char</code>, and
for <code>EOF</code>.
</li><li> These macros ignore the current locale; they are true for these
fixed sets of characters:
<table>
<tr><td><code>ALPHA</code></td><td><kbd>A-Za-z</kbd></td></tr>
<tr><td><code>ALNUM</code></td><td><kbd>A-Za-z0-9</kbd></td></tr>
<tr><td><code>BLANK</code></td><td><kbd>space tab</kbd></td></tr>
<tr><td><code>CNTRL</code></td><td><code>!PRINT</code></td></tr>
<tr><td><code>DIGIT</code></td><td><kbd>0-9</kbd></td></tr>
<tr><td><code>GRAPH</code></td><td><code>ALNUM || PUNCT</code></td></tr>
<tr><td><code>LOWER</code></td><td><kbd>a-z</kbd></td></tr>
<tr><td><code>PRINT</code></td><td><code>GRAPH ||</code> <kbd>space</kbd></td></tr>
<tr><td><code>PUNCT</code></td><td><kbd>`~!@#$%^&amp;*()_-=+[{]}\|;:'&quot;,&lt;.&gt;/?</kbd></td></tr>
<tr><td><code>SPACE</code></td><td><kbd>space tab \n \r \f \v</kbd></td></tr>
<tr><td><code>UPPER</code></td><td><kbd>A-Z</kbd></td></tr>
<tr><td><code>XDIGIT</code></td><td><kbd>0-9A-Fa-f</kbd></td></tr>
</table>
<p>Note that, if the host character set is ASCII or a superset thereof,
all these macros will return false for all values of <code>char</code> outside
the range of 7-bit ASCII. In particular, both ISPRINT and ISCNTRL return
false for characters with numeric values from 128 to 255.
</p></li></ul>
</dd></dl>
<dl>
<dt><a name="index-ISIDNUM"></a>Extension: <strong>ISIDNUM</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-ISIDST"></a>Extension: <strong>ISIDST</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-IS_005fVSPACE"></a>Extension: <strong>IS_VSPACE</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-IS_005fNVSPACE"></a>Extension: <strong>IS_NVSPACE</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-IS_005fSPACE_005fOR_005fNUL"></a>Extension: <strong>IS_SPACE_OR_NUL</strong> <em>(<var>c</var>)</em></dt>
<dt><a name="index-IS_005fISOBASIC"></a>Extension: <strong>IS_ISOBASIC</strong> <em>(<var>c</var>)</em></dt>
<dd><p>These six macros are defined by <samp>safe-ctype.h</samp> and provide
additional character classes which are useful when doing lexical
analysis of C or similar languages. They are true for the following
sets of characters:
</p>
<table>
<tr><td><code>IDNUM</code></td><td><kbd>A-Za-z0-9_</kbd></td></tr>
<tr><td><code>IDST</code></td><td><kbd>A-Za-z_</kbd></td></tr>
<tr><td><code>VSPACE</code></td><td><kbd>\r \n</kbd></td></tr>
<tr><td><code>NVSPACE</code></td><td><kbd>space tab \f \v \0</kbd></td></tr>
<tr><td><code>SPACE_OR_NUL</code></td><td><code>VSPACE || NVSPACE</code></td></tr>
<tr><td><code>ISOBASIC</code></td><td><code>VSPACE || NVSPACE || PRINT</code></td></tr>
</table>
</dd></dl>
<dl>
<dt><a name="index-lbasename"></a>Replacement: <em>const char*</em> <strong>lbasename</strong> <em>(const char *<var>name</var>)</em></dt>
<dd>
<p>Given a pointer to a string containing a typical pathname
(&lsquo;<samp>/usr/src/cmd/ls/ls.c</samp>&rsquo; for example), returns a pointer to the
last component of the pathname (&lsquo;<samp>ls.c</samp>&rsquo; in this case). The
returned pointer is guaranteed to lie within the original
string. This latter fact is not true of many vendor C
libraries, which return special strings or modify the passed
strings for particular input.
</p>
<p>In particular, the empty string returns the same empty string,
and a path ending in <code>/</code> returns the empty string after it.
</p>
</dd></dl>
<dl>
<dt><a name="index-lrealpath"></a>Replacement: <em>const char*</em> <strong>lrealpath</strong> <em>(const char *<var>name</var>)</em></dt>
<dd>
<p>Given a pointer to a string containing a pathname, returns a canonical
version of the filename. Symlinks will be resolved, and &ldquo;.&rdquo; and &ldquo;..&rdquo;
components will be simplified. The returned value will be allocated using
<code>malloc</code>, or <code>NULL</code> will be returned on a memory allocation error.
</p>
</dd></dl>
<dl>
<dt><a name="index-make_005frelative_005fprefix"></a>Extension: <em>const char*</em> <strong>make_relative_prefix</strong> <em>(const char *<var>progname</var>, const char *<var>bin_prefix</var>, const char *<var>prefix</var>)</em></dt>
<dd>
<p>Given three paths <var>progname</var>, <var>bin_prefix</var>, <var>prefix</var>,
return the path that is in the same position relative to
<var>progname</var>&rsquo;s directory as <var>prefix</var> is relative to
<var>bin_prefix</var>. That is, a string starting with the directory
portion of <var>progname</var>, followed by a relative pathname of the
difference between <var>bin_prefix</var> and <var>prefix</var>.
</p>
<p>If <var>progname</var> does not contain any directory separators,
<code>make_relative_prefix</code> will search <code>PATH</code> to find a program
named <var>progname</var>. Also, if <var>progname</var> is a symbolic link,
the symbolic link will be resolved.
</p>
<p>For example, if <var>bin_prefix</var> is <code>/alpha/beta/gamma/gcc/delta</code>,
<var>prefix</var> is <code>/alpha/beta/gamma/omega/</code>, and <var>progname</var> is
<code>/red/green/blue/gcc</code>, then this function will return
<code>/red/green/blue/../../omega/</code>.
</p>
<p>The return value is normally allocated via <code>malloc</code>. If no
relative prefix can be found, return <code>NULL</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-make_005ftemp_005ffile"></a>Replacement: <em>char*</em> <strong>make_temp_file</strong> <em>(const char *<var>suffix</var>)</em></dt>
<dd>
<p>Return a temporary file name (as a string) or <code>NULL</code> if unable to
create one. <var>suffix</var> is a suffix to append to the file name. The
string is <code>malloc</code>ed, and the temporary file has been created.
</p>
</dd></dl>
<dl>
<dt><a name="index-memchr"></a>Supplemental: <em>void*</em> <strong>memchr</strong> <em>(const void *<var>s</var>, int <var>c</var>, size_t <var>n</var>)</em></dt>
<dd>
<p>This function searches memory starting at <code>*<var>s</var></code> for the
character <var>c</var>. The search only ends with the first occurrence of
<var>c</var>, or after <var>length</var> characters; in particular, a null
character does not terminate the search. If the character <var>c</var> is
found within <var>length</var> characters of <code>*<var>s</var></code>, a pointer
to the character is returned. If <var>c</var> is not found, then <code>NULL</code> is
returned.
</p>
</dd></dl>
<dl>
<dt><a name="index-memcmp"></a>Supplemental: <em>int</em> <strong>memcmp</strong> <em>(const void *<var>x</var>, const void *<var>y</var>, size_t <var>count</var>)</em></dt>
<dd>
<p>Compares the first <var>count</var> bytes of two areas of memory. Returns
zero if they are the same, a value less than zero if <var>x</var> is
lexically less than <var>y</var>, or a value greater than zero if <var>x</var>
is lexically greater than <var>y</var>. Note that lexical order is determined
as if comparing unsigned char arrays.
</p>
</dd></dl>
<dl>
<dt><a name="index-memcpy"></a>Supplemental: <em>void*</em> <strong>memcpy</strong> <em>(void *<var>out</var>, const void *<var>in</var>, size_t <var>length</var>)</em></dt>
<dd>
<p>Copies <var>length</var> bytes from memory region <var>in</var> to region
<var>out</var>. Returns a pointer to <var>out</var>.
</p>
</dd></dl>
<dl>
<dt><a name="index-memmem"></a>Supplemental: <em>void*</em> <strong>memmem</strong> <em>(const void *<var>haystack</var>, size_t <var>haystack_len</var> const void *<var>needle</var>, size_t <var>needle_len</var>)</em></dt>
<dd>
<p>Returns a pointer to the first occurrence of <var>needle</var> (length
<var>needle_len</var>) in <var>haystack</var> (length <var>haystack_len</var>).
Returns <code>NULL</code> if not found.
</p>
</dd></dl>
<dl>
<dt><a name="index-memmove"></a>Supplemental: <em>void*</em> <strong>memmove</strong> <em>(void *<var>from</var>, const void *<var>to</var>, size_t <var>count</var>)</em></dt>
<dd>
<p>Copies <var>count</var> bytes from memory area <var>from</var> to memory area
<var>to</var>, returning a pointer to <var>to</var>.
</p>
</dd></dl>
<dl>
<dt><a name="index-mempcpy"></a>Supplemental: <em>void*</em> <strong>mempcpy</strong> <em>(void *<var>out</var>, const void *<var>in</var>, size_t <var>length</var>)</em></dt>
<dd>
<p>Copies <var>length</var> bytes from memory region <var>in</var> to region
<var>out</var>. Returns a pointer to <var>out</var> + <var>length</var>.
</p>
</dd></dl>
<dl>
<dt><a name="index-memset"></a>Supplemental: <em>void*</em> <strong>memset</strong> <em>(void *<var>s</var>, int <var>c</var>, size_t <var>count</var>)</em></dt>
<dd>
<p>Sets the first <var>count</var> bytes of <var>s</var> to the constant byte
<var>c</var>, returning a pointer to <var>s</var>.
</p>
</dd></dl>
<dl>
<dt><a name="index-mkstemps"></a>Replacement: <em>int</em> <strong>mkstemps</strong> <em>(char *<var>pattern</var>, int <var>suffix_len</var>)</em></dt>
<dd>
<p>Generate a unique temporary file name from <var>pattern</var>.
<var>pattern</var> has the form:
</p>
<div class="example">
<pre class="example"> <var>path</var>/ccXXXXXX<var>suffix</var>
</pre></div>
<p><var>suffix_len</var> tells us how long <var>suffix</var> is (it can be zero
length). The last six characters of <var>pattern</var> before <var>suffix</var>
must be &lsquo;<samp>XXXXXX</samp>&rsquo;; they are replaced with a string that makes the
filename unique. Returns a file descriptor open on the file for
reading and writing.
</p>
</dd></dl>
<dl>
<dt><a name="index-pex_005ffree"></a>Extension: <em>void</em> <strong>pex_free</strong> <em>(struct pex_obj <var>obj</var>)</em></dt>
<dd>
<p>Clean up and free all data associated with <var>obj</var>. If you have not
yet called <code>pex_get_times</code> or <code>pex_get_status</code>, this will
try to kill the subprocesses.
</p>
</dd></dl>
<dl>
<dt><a name="index-pex_005fget_005fstatus"></a>Extension: <em>int</em> <strong>pex_get_status</strong> <em>(struct pex_obj *<var>obj</var>, int <var>count</var>, int *<var>vector</var>)</em></dt>
<dd>
<p>Returns the exit status of all programs run using <var>obj</var>.
<var>count</var> is the number of results expected. The results will be
placed into <var>vector</var>. The results are in the order of the calls
to <code>pex_run</code>. Returns 0 on error, 1 on success.
</p>
</dd></dl>
<dl>
<dt><a name="index-pex_005fget_005ftimes"></a>Extension: <em>int</em> <strong>pex_get_times</strong> <em>(struct pex_obj *<var>obj</var>, int <var>count</var>, struct pex_time *<var>vector</var>)</em></dt>
<dd>
<p>Returns the process execution times of all programs run using
<var>obj</var>. <var>count</var> is the number of results expected. The
results will be placed into <var>vector</var>. The results are in the
order of the calls to <code>pex_run</code>. Returns 0 on error, 1 on
success.
</p>
<p><code>struct pex_time</code> has the following fields of the type
<code>unsigned long</code>: <code>user_seconds</code>,
<code>user_microseconds</code>, <code>system_seconds</code>,
<code>system_microseconds</code>. On systems which do not support reporting
process times, all the fields will be set to <code>0</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-pex_005finit"></a>Extension: <em>struct pex_obj *</em> <strong>pex_init</strong> <em>(int <var>flags</var>, const char *<var>pname</var>, const char *<var>tempbase</var>)</em></dt>
<dd>
<p>Prepare to execute one or more programs, with standard output of each
program fed to standard input of the next. This is a system
independent interface to execute a pipeline.
</p>
<p><var>flags</var> is a bitwise combination of the following:
</p>
<dl compact="compact">
<dd>
<a name="index-PEX_005fRECORD_005fTIMES"></a>
</dd>
<dt><code>PEX_RECORD_TIMES</code></dt>
<dd><p>Record subprocess times if possible.
</p>
<a name="index-PEX_005fUSE_005fPIPES"></a>
</dd>
<dt><code>PEX_USE_PIPES</code></dt>
<dd><p>Use pipes for communication between processes, if possible.
</p>
<a name="index-PEX_005fSAVE_005fTEMPS"></a>
</dd>
<dt><code>PEX_SAVE_TEMPS</code></dt>
<dd><p>Don&rsquo;t delete temporary files used for communication between
processes.
</p>
</dd>
</dl>
<p><var>pname</var> is the name of program to be executed, used in error
messages. <var>tempbase</var> is a base name to use for any required
temporary files; it may be <code>NULL</code> to use a randomly chosen name.
</p>
</dd></dl>
<dl>
<dt><a name="index-pex_005finput_005ffile"></a>Extension: <em>FILE *</em> <strong>pex_input_file</strong> <em>(struct pex_obj *<var>obj</var>, int <var>flags</var>, const char *<var>in_name</var>)</em></dt>
<dd>
<p>Return a stream for a temporary file to pass to the first program in
the pipeline as input.
</p>
<p>The name of the input file is chosen according to the same rules
<code>pex_run</code> uses to choose output file names, based on
<var>in_name</var>, <var>obj</var> and the <code>PEX_SUFFIX</code> bit in <var>flags</var>.
</p>
<p>Don&rsquo;t call <code>fclose</code> on the returned stream; the first call to
<code>pex_run</code> closes it automatically.
</p>
<p>If <var>flags</var> includes <code>PEX_BINARY_OUTPUT</code>, open the stream in
binary mode; otherwise, open it in the default mode. Including
<code>PEX_BINARY_OUTPUT</code> in <var>flags</var> has no effect on Unix.
</p></dd></dl>
<dl>
<dt><a name="index-pex_005finput_005fpipe"></a>Extension: <em>FILE *</em> <strong>pex_input_pipe</strong> <em>(struct pex_obj *<var>obj</var>, int <var>binary</var>)</em></dt>
<dd>
<p>Return a stream <var>fp</var> for a pipe connected to the standard input of
the first program in the pipeline; <var>fp</var> is opened for writing.
You must have passed <code>PEX_USE_PIPES</code> to the <code>pex_init</code> call
that returned <var>obj</var>.
</p>
<p>You must close <var>fp</var> using <code>fclose</code> yourself when you have
finished writing data to the pipeline.
</p>
<p>The file descriptor underlying <var>fp</var> is marked not to be inherited
by child processes.
</p>
<p>On systems that do not support pipes, this function returns
<code>NULL</code>, and sets <code>errno</code> to <code>EINVAL</code>. If you would
like to write code that is portable to all systems the <code>pex</code>
functions support, consider using <code>pex_input_file</code> instead.
</p>
<p>There are two opportunities for deadlock using
<code>pex_input_pipe</code>:
</p>
<ul>
<li> Most systems&rsquo; pipes can buffer only a fixed amount of data; a process
that writes to a full pipe blocks. Thus, if you write to <samp>fp</samp>
before starting the first process, you run the risk of blocking when
there is no child process yet to read the data and allow you to
continue. <code>pex_input_pipe</code> makes no promises about the
size of the pipe&rsquo;s buffer, so if you need to write any data at all
before starting the first process in the pipeline, consider using
<code>pex_input_file</code> instead.
</li><li> Using <code>pex_input_pipe</code> and <code>pex_read_output</code> together
may also cause deadlock. If the output pipe fills up, so that each
program in the pipeline is waiting for the next to read more data, and
you fill the input pipe by writing more data to <var>fp</var>, then there
is no way to make progress: the only process that could read data from
the output pipe is you, but you are blocked on the input pipe.
</li></ul>
</dd></dl>
<dl>
<dt><a name="index-pex_005fone"></a>Extension: <em>const char *</em> <strong>pex_one</strong> <em>(int <var>flags</var>, const char *<var>executable</var>, char * const *<var>argv</var>, const char *<var>pname</var>, const char *<var>outname</var>, const char *<var>errname</var>, int *<var>status</var>, int *<var>err</var>)</em></dt>
<dd>
<p>An interface to permit the easy execution of a
single program. The return value and most of the parameters are as
for a call to <code>pex_run</code>. <var>flags</var> is restricted to a
combination of <code>PEX_SEARCH</code>, <code>PEX_STDERR_TO_STDOUT</code>, and
<code>PEX_BINARY_OUTPUT</code>. <var>outname</var> is interpreted as if
<code>PEX_LAST</code> were set. On a successful return, <code>*<var>status</var></code> will
be set to the exit status of the program.
</p>
</dd></dl>
<dl>
<dt><a name="index-pex_005fread_005ferr"></a>Extension: <em>FILE *</em> <strong>pex_read_err</strong> <em>(struct pex_obj *<var>obj</var>, int <var>binary</var>)</em></dt>
<dd>
<p>Returns a <code>FILE</code> pointer which may be used to read the standard
error of the last program in the pipeline. When this is used,
<code>PEX_LAST</code> should not be used in a call to <code>pex_run</code>. After
this is called, <code>pex_run</code> may no longer be called with the same
<var>obj</var>. <var>binary</var> should be non-zero if the file should be
opened in binary mode. Don&rsquo;t call <code>fclose</code> on the returned file;
it will be closed by <code>pex_free</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-pex_005fread_005foutput"></a>Extension: <em>FILE *</em> <strong>pex_read_output</strong> <em>(struct pex_obj *<var>obj</var>, int <var>binary</var>)</em></dt>
<dd>
<p>Returns a <code>FILE</code> pointer which may be used to read the standard
output of the last program in the pipeline. When this is used,
<code>PEX_LAST</code> should not be used in a call to <code>pex_run</code>. After
this is called, <code>pex_run</code> may no longer be called with the same
<var>obj</var>. <var>binary</var> should be non-zero if the file should be
opened in binary mode. Don&rsquo;t call <code>fclose</code> on the returned file;
it will be closed by <code>pex_free</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-pex_005frun"></a>Extension: <em>const char *</em> <strong>pex_run</strong> <em>(struct pex_obj *<var>obj</var>, int <var>flags</var>, const char *<var>executable</var>, char * const *<var>argv</var>, const char *<var>outname</var>, const char *<var>errname</var>, int *<var>err</var>)</em></dt>
<dd>
<p>Execute one program in a pipeline. On success this returns
<code>NULL</code>. On failure it returns an error message, a statically
allocated string.
</p>
<p><var>obj</var> is returned by a previous call to <code>pex_init</code>.
</p>
<p><var>flags</var> is a bitwise combination of the following:
</p>
<dl compact="compact">
<dd>
<a name="index-PEX_005fLAST"></a>
</dd>
<dt><code>PEX_LAST</code></dt>
<dd><p>This must be set on the last program in the pipeline. In particular,
it should be set when executing a single program. The standard output
of the program will be sent to <var>outname</var>, or, if <var>outname</var> is
<code>NULL</code>, to the standard output of the calling program. Do <em>not</em>
set this bit if you want to call <code>pex_read_output</code>
(described below). After a call to <code>pex_run</code> with this bit set,
<var>pex_run</var> may no longer be called with the same <var>obj</var>.
</p>
<a name="index-PEX_005fSEARCH"></a>
</dd>
<dt><code>PEX_SEARCH</code></dt>
<dd><p>Search for the program using the user&rsquo;s executable search path.
</p>
<a name="index-PEX_005fSUFFIX"></a>
</dd>
<dt><code>PEX_SUFFIX</code></dt>
<dd><p><var>outname</var> is a suffix. See the description of <var>outname</var>,
below.
</p>
<a name="index-PEX_005fSTDERR_005fTO_005fSTDOUT"></a>
</dd>
<dt><code>PEX_STDERR_TO_STDOUT</code></dt>
<dd><p>Send the program&rsquo;s standard error to standard output, if possible.
</p>
<a name="index-PEX_005fBINARY_005fINPUT"></a>
<a name="index-PEX_005fBINARY_005fOUTPUT"></a>
<a name="index-PEX_005fBINARY_005fERROR"></a>
</dd>
<dt><code>PEX_BINARY_INPUT</code></dt>
<dt><code>PEX_BINARY_OUTPUT</code></dt>
<dt><code>PEX_BINARY_ERROR</code></dt>
<dd><p>The standard input (output or error) of the program should be read (written) in
binary mode rather than text mode. These flags are ignored on systems
which do not distinguish binary mode and text mode, such as Unix. For
proper behavior these flags should match appropriately&mdash;a call to
<code>pex_run</code> using <code>PEX_BINARY_OUTPUT</code> should be followed by a
call using <code>PEX_BINARY_INPUT</code>.
</p>
<a name="index-PEX_005fSTDERR_005fTO_005fPIPE"></a>
</dd>
<dt><code>PEX_STDERR_TO_PIPE</code></dt>
<dd><p>Send the program&rsquo;s standard error to a pipe, if possible. This flag
cannot be specified together with <code>PEX_STDERR_TO_STDOUT</code>. This
flag can be specified only on the last program in pipeline.
</p>
</dd>
</dl>
<p><var>executable</var> is the program to execute. <var>argv</var> is the set of
arguments to pass to the program; normally <code><var>argv</var>[0]</code> will
be a copy of <var>executable</var>.
</p>
<p><var>outname</var> is used to set the name of the file to use for standard
output. There are two cases in which no output file will be used:
</p>
<ol>
<li> if <code>PEX_LAST</code> is not set in <var>flags</var>, and <code>PEX_USE_PIPES</code>
was set in the call to <code>pex_init</code>, and the system supports pipes
</li><li> if <code>PEX_LAST</code> is set in <var>flags</var>, and <var>outname</var> is
<code>NULL</code>
</li></ol>
<p>Otherwise the code will use a file to hold standard
output. If <code>PEX_LAST</code> is not set, this file is considered to be
a temporary file, and it will be removed when no longer needed, unless
<code>PEX_SAVE_TEMPS</code> was set in the call to <code>pex_init</code>.
</p>
<p>There are two cases to consider when setting the name of the file to
hold standard output.
</p>
<ol>
<li> <code>PEX_SUFFIX</code> is set in <var>flags</var>. In this case
<var>outname</var> may not be <code>NULL</code>. If the <var>tempbase</var> parameter
to <code>pex_init</code> was not <code>NULL</code>, then the output file name is
the concatenation of <var>tempbase</var> and <var>outname</var>. If
<var>tempbase</var> was <code>NULL</code>, then the output file name is a random
file name ending in <var>outname</var>.
</li><li> <code>PEX_SUFFIX</code> was not set in <var>flags</var>. In this
case, if <var>outname</var> is not <code>NULL</code>, it is used as the output
file name. If <var>outname</var> is <code>NULL</code>, and <var>tempbase</var> was
not NULL, the output file name is randomly chosen using
<var>tempbase</var>. Otherwise the output file name is chosen completely
at random.
</li></ol>
<p><var>errname</var> is the file name to use for standard error output. If
it is <code>NULL</code>, standard error is the same as the caller&rsquo;s.
Otherwise, standard error is written to the named file.
</p>
<p>On an error return, the code sets <code>*<var>err</var></code> to an <code>errno</code>
value, or to 0 if there is no relevant <code>errno</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-pex_005frun_005fin_005fenvironment"></a>Extension: <em>const char *</em> <strong>pex_run_in_environment</strong> <em>(struct pex_obj *<var>obj</var>, int <var>flags</var>, const char *<var>executable</var>, char * const *<var>argv</var>, char * const *<var>env</var>, int <var>env_size</var>, const char *<var>outname</var>, const char *<var>errname</var>, int *<var>err</var>)</em></dt>
<dd>
<p>Execute one program in a pipeline, permitting the environment for the
program to be specified. Behaviour and parameters not listed below are
as for <code>pex_run</code>.
</p>
<p><var>env</var> is the environment for the child process, specified as an array of
character pointers. Each element of the array should point to a string of the
form <code>VAR=VALUE</code>, with the exception of the last element that must be
<code>NULL</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-pexecute"></a>Extension: <em>int</em> <strong>pexecute</strong> <em>(const char *<var>program</var>, char * const *<var>argv</var>, const char *<var>this_pname</var>, const char *<var>temp_base</var>, char **<var>errmsg_fmt</var>, char **<var>errmsg_arg</var>, int <var>flags</var>)</em></dt>
<dd>
<p>This is the old interface to execute one or more programs. It is
still supported for compatibility purposes, but is no longer
documented.
</p>
</dd></dl>
<dl>
<dt><a name="index-psignal"></a>Supplemental: <em>void</em> <strong>psignal</strong> <em>(int <var>signo</var>, char *<var>message</var>)</em></dt>
<dd>
<p>Print <var>message</var> to the standard error, followed by a colon,
followed by the description of the signal specified by <var>signo</var>,
followed by a newline.
</p>
</dd></dl>
<dl>
<dt><a name="index-putenv"></a>Supplemental: <em>int</em> <strong>putenv</strong> <em>(const char *<var>string</var>)</em></dt>
<dd>
<p>Uses <code>setenv</code> or <code>unsetenv</code> to put <var>string</var> into
the environment or remove it. If <var>string</var> is of the form
&lsquo;<samp>name=value</samp>&rsquo; the string is added; if no &lsquo;<samp>=</samp>&rsquo; is present the
name is unset/removed.
</p>
</dd></dl>
<dl>
<dt><a name="index-pwait"></a>Extension: <em>int</em> <strong>pwait</strong> <em>(int <var>pid</var>, int *<var>status</var>, int <var>flags</var>)</em></dt>
<dd>
<p>Another part of the old execution interface.
</p>
</dd></dl>
<dl>
<dt><a name="index-random"></a>Supplement: <em>long int</em> <strong>random</strong> <em>(void)</em></dt>
<dt><a name="index-srandom"></a>Supplement: <em>void</em> <strong>srandom</strong> <em>(unsigned int <var>seed</var>)</em></dt>
<dt><a name="index-initstate"></a>Supplement: <em>void*</em> <strong>initstate</strong> <em>(unsigned int <var>seed</var>, void *<var>arg_state</var>, unsigned long <var>n</var>)</em></dt>
<dt><a name="index-setstate"></a>Supplement: <em>void*</em> <strong>setstate</strong> <em>(void *<var>arg_state</var>)</em></dt>
<dd>
<p>Random number functions. <code>random</code> returns a random number in the
range 0 to <code>LONG_MAX</code>. <code>srandom</code> initializes the random
number generator to some starting point determined by <var>seed</var>
(else, the values returned by <code>random</code> are always the same for each
run of the program). <code>initstate</code> and <code>setstate</code> allow fine-grained
control over the state of the random number generator.
</p>
</dd></dl>
<dl>
<dt><a name="index-reconcat"></a>Extension: <em>char*</em> <strong>reconcat</strong> <em>(char *<var>optr</var>, const char *<var>s1</var>, &hellip;, <code>NULL</code>)</em></dt>
<dd>
<p>Same as <code>concat</code>, except that if <var>optr</var> is not <code>NULL</code> it
is freed after the string is created. This is intended to be useful
when you&rsquo;re extending an existing string or building up a string in a
loop:
</p>
<div class="example">
<pre class="example"> str = reconcat (str, &quot;pre-&quot;, str, NULL);
</pre></div>
</dd></dl>
<dl>
<dt><a name="index-rename"></a>Supplemental: <em>int</em> <strong>rename</strong> <em>(const char *<var>old</var>, const char *<var>new</var>)</em></dt>
<dd>
<p>Renames a file from <var>old</var> to <var>new</var>. If <var>new</var> already
exists, it is removed.
</p>
</dd></dl>
<dl>
<dt><a name="index-rindex"></a>Supplemental: <em>char*</em> <strong>rindex</strong> <em>(const char *<var>s</var>, int <var>c</var>)</em></dt>
<dd>
<p>Returns a pointer to the last occurrence of the character <var>c</var> in
the string <var>s</var>, or <code>NULL</code> if not found. The use of <code>rindex</code> is
deprecated in new programs in favor of <code>strrchr</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-setenv"></a>Supplemental: <em>int</em> <strong>setenv</strong> <em>(const char *<var>name</var>, const char *<var>value</var>, int <var>overwrite</var>)</em></dt>
<dt><a name="index-unsetenv"></a>Supplemental: <em>void</em> <strong>unsetenv</strong> <em>(const char *<var>name</var>)</em></dt>
<dd>
<p><code>setenv</code> adds <var>name</var> to the environment with value
<var>value</var>. If the name was already present in the environment,
the new value will be stored only if <var>overwrite</var> is nonzero.
The companion <code>unsetenv</code> function removes <var>name</var> from the
environment. This implementation is not safe for multithreaded code.
</p>
</dd></dl>
<dl>
<dt><a name="index-setproctitle"></a>Supplemental: <em>void</em> <strong>setproctitle</strong> <em>(const char *<var>fmt</var>, ...)</em></dt>
<dd>
<p>Set the title of a process to <var>fmt</var>. va args not supported for now,
but defined for compatibility with BSD.
</p>
</dd></dl>
<dl>
<dt><a name="index-signo_005fmax"></a>Extension: <em>int</em> <strong>signo_max</strong> <em>(void)</em></dt>
<dd>
<p>Returns the maximum signal value for which a corresponding symbolic
name or message is available. Note that in the case where we use the
<code>sys_siglist</code> supplied by the system, it is possible for there to
be more symbolic names than messages, or vice versa. In fact, the
manual page for <code>psignal(3b)</code> explicitly warns that one should
check the size of the table (<code>NSIG</code>) before indexing it, since
new signal codes may be added to the system before they are added to
the table. Thus <code>NSIG</code> might be smaller than value implied by
the largest signo value defined in <code>&lt;signal.h&gt;</code>.
</p>
<p>We return the maximum value that can be used to obtain a meaningful
symbolic name or message.
</p>
</dd></dl>
<dl>
<dt><a name="index-sigsetmask"></a>Supplemental: <em>int</em> <strong>sigsetmask</strong> <em>(int <var>set</var>)</em></dt>
<dd>
<p>Sets the signal mask to the one provided in <var>set</var> and returns
the old mask (which, for libiberty&rsquo;s implementation, will always
be the value <code>1</code>).
</p>
</dd></dl>
<dl>
<dt><a name="index-simple_005fobject_005fattributes_005fcompare"></a>Extension: <em>const char *</em> <strong>simple_object_attributes_compare</strong> <em>(simple_object_attributes *<var>attrs1</var>, simple_object_attributes *<var>attrs2</var>, int *<var>err</var>)</em></dt>
<dd>
<p>Compare <var>attrs1</var> and <var>attrs2</var>. If they could be linked
together without error, return <code>NULL</code>. Otherwise, return an
error message and set <code>*<var>err</var></code> to an errno value or <code>0</code>
if there is no relevant errno.
</p>
</dd></dl>
<dl>
<dt><a name="index-simple_005fobject_005ffetch_005fattributes"></a>Extension: <em>simple_object_attributes *</em> <strong>simple_object_fetch_attributes</strong> <em>(simple_object_read *<var>simple_object</var>, const char **<var>errmsg</var>, int *<var>err</var>)</em></dt>
<dd>
<p>Fetch the attributes of <var>simple_object</var>. The attributes are
internal information such as the format of the object file, or the
architecture it was compiled for. This information will persist until
<code>simple_object_attributes_release</code> is called, even if
<var>simple_object</var> itself is released.
</p>
<p>On error this returns <code>NULL</code>, sets <code>*<var>errmsg</var></code> to an
error message, and sets <code>*<var>err</var></code> to an errno value or
<code>0</code> if there is no relevant errno.
</p>
</dd></dl>
<dl>
<dt><a name="index-simple_005fobject_005ffind_005fsection"></a>Extension: <em>int</em> <strong>simple_object_find_section</strong> <em>(simple_object_read *<var>simple_object</var> off_t *<var>offset</var>, off_t *<var>length</var>, const char **<var>errmsg</var>, int *<var>err</var>)</em></dt>
<dd>
<p>Look for the section <var>name</var> in <var>simple_object</var>. This returns
information for the first section with that name.
</p>
<p>If found, return 1 and set <code>*<var>offset</var></code> to the offset in the
file of the section contents and set <code>*<var>length</var></code> to the
length of the section contents. The value in <code>*<var>offset</var></code>
will be relative to the offset passed to
<code>simple_object_open_read</code>.
</p>
<p>If the section is not found, and no error occurs,
<code>simple_object_find_section</code> returns <code>0</code> and set
<code>*<var>errmsg</var></code> to <code>NULL</code>.
</p>
<p>If an error occurs, <code>simple_object_find_section</code> returns
<code>0</code>, sets <code>*<var>errmsg</var></code> to an error message, and sets
<code>*<var>err</var></code> to an errno value or <code>0</code> if there is no
relevant errno.
</p>
</dd></dl>
<dl>
<dt><a name="index-simple_005fobject_005ffind_005fsections"></a>Extension: <em>const char *</em> <strong>simple_object_find_sections</strong> <em>(simple_object_read *<var>simple_object</var>, int (*<var>pfn</var>) (void *<var>data</var>, const char *<var>name</var>, off_t <var>offset</var>, off_t <var>length</var>), void *<var>data</var>, int *<var>err</var>)</em></dt>
<dd>
<p>This function calls <var>pfn</var> for each section in <var>simple_object</var>.
It calls <var>pfn</var> with the section name, the offset within the file
of the section contents, and the length of the section contents. The
offset within the file is relative to the offset passed to
<code>simple_object_open_read</code>. The <var>data</var> argument to this
function is passed along to <var>pfn</var>.
</p>
<p>If <var>pfn</var> returns <code>0</code>, the loop over the sections stops and
<code>simple_object_find_sections</code> returns. If <var>pfn</var> returns some
other value, the loop continues.
</p>
<p>On success <code>simple_object_find_sections</code> returns. On error it
returns an error string, and sets <code>*<var>err</var></code> to an errno value
or <code>0</code> if there is no relevant errno.
</p>
</dd></dl>
<dl>
<dt><a name="index-simple_005fobject_005fopen_005fread"></a>Extension: <em>simple_object_read *</em> <strong>simple_object_open_read</strong> <em>(int <var>descriptor</var>, off_t <var>offset</var>, const char *segment_name, const char **<var>errmsg</var>, int *<var>err</var>)</em></dt>
<dd>
<p>Opens an object file for reading. Creates and returns an
<code>simple_object_read</code> pointer which may be passed to other
functions to extract data from the object file.
</p>
<p><var>descriptor</var> holds a file descriptor which permits reading.
</p>
<p><var>offset</var> is the offset into the file; this will be <code>0</code> in the
normal case, but may be a different value when reading an object file
in an archive file.
</p>
<p><var>segment_name</var> is only used with the Mach-O file format used on
Darwin aka Mac OS X. It is required on that platform, and means to
only look at sections within the segment with that name. The
parameter is ignored on other systems.
</p>
<p>If an error occurs, this functions returns <code>NULL</code> and sets
<code>*<var>errmsg</var></code> to an error string and sets <code>*<var>err</var></code> to
an errno value or <code>0</code> if there is no relevant errno.
</p>
</dd></dl>
<dl>
<dt><a name="index-simple_005fobject_005frelease_005fattributes"></a>Extension: <em>void</em> <strong>simple_object_release_attributes</strong> <em>(simple_object_attributes *<var>attrs</var>)</em></dt>
<dd>
<p>Release all resources associated with <var>attrs</var>.
</p>
</dd></dl>
<dl>
<dt><a name="index-simple_005fobject_005frelease_005fread"></a>Extension: <em>void</em> <strong>simple_object_release_read</strong> <em>(simple_object_read *<var>simple_object</var>)</em></dt>
<dd>
<p>Release all resources associated with <var>simple_object</var>. This does
not close the file descriptor.
</p>
</dd></dl>
<dl>
<dt><a name="index-simple_005fobject_005frelease_005fwrite"></a>Extension: <em>void</em> <strong>simple_object_release_write</strong> <em>(simple_object_write *<var>simple_object</var>)</em></dt>
<dd>
<p>Release all resources associated with <var>simple_object</var>.
</p>
</dd></dl>
<dl>
<dt><a name="index-simple_005fobject_005fstart_005fwrite"></a>Extension: <em>simple_object_write *</em> <strong>simple_object_start_write</strong> <em>(simple_object_attributes <var>attrs</var>, const char *<var>segment_name</var>, const char **<var>errmsg</var>, int *<var>err</var>)</em></dt>
<dd>
<p>Start creating a new object file using the object file format
described in <var>attrs</var>. You must fetch attribute information from
an existing object file before you can create a new one. There is
currently no support for creating an object file de novo.
</p>
<p><var>segment_name</var> is only used with Mach-O as found on Darwin aka Mac
OS X. The parameter is required on that target. It means that all
sections are created within the named segment. It is ignored for
other object file formats.
</p>
<p>On error <code>simple_object_start_write</code> returns <code>NULL</code>, sets
<code>*<var>ERRMSG</var></code> to an error message, and sets <code>*<var>err</var></code>
to an errno value or <code>0</code> if there is no relevant errno.
</p>
</dd></dl>
<dl>
<dt><a name="index-simple_005fobject_005fwrite_005fadd_005fdata"></a>Extension: <em>const char *</em> <strong>simple_object_write_add_data</strong> <em>(simple_object_write *<var>simple_object</var>, simple_object_write_section *<var>section</var>, const void *<var>buffer</var>, size_t <var>size</var>, int <var>copy</var>, int *<var>err</var>)</em></dt>
<dd>
<p>Add data <var>buffer</var>/<var>size</var> to <var>section</var> in
<var>simple_object</var>. If <var>copy</var> is non-zero, the data will be
copied into memory if necessary. If <var>copy</var> is zero, <var>buffer</var>
must persist until <code>simple_object_write_to_file</code> is called. is
released.
</p>
<p>On success this returns <code>NULL</code>. On error this returns an error
message, and sets <code>*<var>err</var></code> to an errno value or 0 if there is
no relevant erro.
</p>
</dd></dl>
<dl>
<dt><a name="index-simple_005fobject_005fwrite_005fcreate_005fsection"></a>Extension: <em>simple_object_write_section *</em> <strong>simple_object_write_create_section</strong> <em>(simple_object_write *<var>simple_object</var>, const char *<var>name</var>, unsigned int <var>align</var>, const char **<var>errmsg</var>, int *<var>err</var>)</em></dt>
<dd>
<p>Add a section to <var>simple_object</var>. <var>name</var> is the name of the
new section. <var>align</var> is the required alignment expressed as the
number of required low-order 0 bits (e.g., 2 for alignment to a 32-bit
boundary).
</p>
<p>The section is created as containing data, readable, not writable, not
executable, not loaded at runtime. The section is not written to the
file until <code>simple_object_write_to_file</code> is called.
</p>
<p>On error this returns <code>NULL</code>, sets <code>*<var>errmsg</var></code> to an
error message, and sets <code>*<var>err</var></code> to an errno value or
<code>0</code> if there is no relevant errno.
</p>
</dd></dl>
<dl>
<dt><a name="index-simple_005fobject_005fwrite_005fto_005ffile"></a>Extension: <em>const char *</em> <strong>simple_object_write_to_file</strong> <em>(simple_object_write *<var>simple_object</var>, int <var>descriptor</var>, int *<var>err</var>)</em></dt>
<dd>
<p>Write the complete object file to <var>descriptor</var>, an open file
descriptor. This writes out all the data accumulated by calls to
<code>simple_object_write_create_section</code> and
<var>simple_object_write_add_data</var>.
</p>
<p>This returns <code>NULL</code> on success. On error this returns an error
message and sets <code>*<var>err</var></code> to an errno value or <code>0</code> if
there is no relevant errno.
</p>
</dd></dl>
<dl>
<dt><a name="index-snprintf"></a>Supplemental: <em>int</em> <strong>snprintf</strong> <em>(char *<var>buf</var>, size_t <var>n</var>, const char *<var>format</var>, ...)</em></dt>
<dd>
<p>This function is similar to <code>sprintf</code>, but it will write to
<var>buf</var> at most <code><var>n</var>-1</code> bytes of text, followed by a
terminating null byte, for a total of <var>n</var> bytes.
On error the return value is -1, otherwise it returns the number of
bytes, not including the terminating null byte, that would have been
written had <var>n</var> been sufficiently large, regardless of the actual
value of <var>n</var>. Note some pre-C99 system libraries do not implement
this correctly so users cannot generally rely on the return value if
the system version of this function is used.
</p>
</dd></dl>
<dl>
<dt><a name="index-spaces"></a>Extension: <em>char*</em> <strong>spaces</strong> <em>(int <var>count</var>)</em></dt>
<dd>
<p>Returns a pointer to a memory region filled with the specified
number of spaces and null terminated. The returned pointer is
valid until at least the next call.
</p>
</dd></dl>
<dl>
<dt><a name="index-splay_005ftree_005fnew_005fwith_005ftyped_005falloc"></a>Supplemental: <em>splay_tree</em> <strong>splay_tree_new_with_typed_alloc</strong> <em>(splay_tree_compare_fn <var>compare_fn</var>, splay_tree_delete_key_fn <var>delete_key_fn</var>, splay_tree_delete_value_fn <var>delete_value_fn</var>, splay_tree_allocate_fn <var>tree_allocate_fn</var>, splay_tree_allocate_fn <var>node_allocate_fn</var>, splay_tree_deallocate_fn <var>deallocate_fn</var>, void * <var>allocate_data</var>)</em></dt>
<dd>
<p>This function creates a splay tree that uses two different allocators
<var>tree_allocate_fn</var> and <var>node_allocate_fn</var> to use for allocating the
tree itself and its nodes respectively. This is useful when variables of
different types need to be allocated with different allocators.
</p>
<p>The splay tree will use <var>compare_fn</var> to compare nodes,
<var>delete_key_fn</var> to deallocate keys, and <var>delete_value_fn</var> to
deallocate values.
</p>
</dd></dl>
<dl>
<dt><a name="index-stack_005flimit_005fincrease"></a>Extension: <em>void</em> <strong>stack_limit_increase</strong> <em>(unsigned long <var>pref</var>)</em></dt>
<dd>
<p>Attempt to increase stack size limit to <var>pref</var> bytes if possible.
</p>
</dd></dl>
<dl>
<dt><a name="index-stpcpy"></a>Supplemental: <em>char*</em> <strong>stpcpy</strong> <em>(char *<var>dst</var>, const char *<var>src</var>)</em></dt>
<dd>
<p>Copies the string <var>src</var> into <var>dst</var>. Returns a pointer to
<var>dst</var> + strlen(<var>src</var>).
</p>
</dd></dl>
<dl>
<dt><a name="index-stpncpy"></a>Supplemental: <em>char*</em> <strong>stpncpy</strong> <em>(char *<var>dst</var>, const char *<var>src</var>, size_t <var>len</var>)</em></dt>
<dd>
<p>Copies the string <var>src</var> into <var>dst</var>, copying exactly <var>len</var>
and padding with zeros if necessary. If <var>len</var> &lt; strlen(<var>src</var>)
then return <var>dst</var> + <var>len</var>, otherwise returns <var>dst</var> +
strlen(<var>src</var>).
</p>
</dd></dl>
<dl>
<dt><a name="index-strcasecmp"></a>Supplemental: <em>int</em> <strong>strcasecmp</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>)</em></dt>
<dd>
<p>A case-insensitive <code>strcmp</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-strchr"></a>Supplemental: <em>char*</em> <strong>strchr</strong> <em>(const char *<var>s</var>, int <var>c</var>)</em></dt>
<dd>
<p>Returns a pointer to the first occurrence of the character <var>c</var> in
the string <var>s</var>, or <code>NULL</code> if not found. If <var>c</var> is itself the
null character, the results are undefined.
</p>
</dd></dl>
<dl>
<dt><a name="index-strdup"></a>Supplemental: <em>char*</em> <strong>strdup</strong> <em>(const char *<var>s</var>)</em></dt>
<dd>
<p>Returns a pointer to a copy of <var>s</var> in memory obtained from
<code>malloc</code>, or <code>NULL</code> if insufficient memory was available.
</p>
</dd></dl>
<dl>
<dt><a name="index-strerrno"></a>Replacement: <em>const char*</em> <strong>strerrno</strong> <em>(int <var>errnum</var>)</em></dt>
<dd>
<p>Given an error number returned from a system call (typically returned
in <code>errno</code>), returns a pointer to a string containing the
symbolic name of that error number, as found in <code>&lt;errno.h&gt;</code>.
</p>
<p>If the supplied error number is within the valid range of indices for
symbolic names, but no name is available for the particular error
number, then returns the string &lsquo;<samp>Error <var>num</var></samp>&rsquo;, where <var>num</var>
is the error number.
</p>
<p>If the supplied error number is not within the range of valid
indices, then returns <code>NULL</code>.
</p>
<p>The contents of the location pointed to are only guaranteed to be
valid until the next call to <code>strerrno</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-strerror"></a>Supplemental: <em>char*</em> <strong>strerror</strong> <em>(int <var>errnoval</var>)</em></dt>
<dd>
<p>Maps an <code>errno</code> number to an error message string, the contents
of which are implementation defined. On systems which have the
external variables <code>sys_nerr</code> and <code>sys_errlist</code>, these
strings will be the same as the ones used by <code>perror</code>.
</p>
<p>If the supplied error number is within the valid range of indices for
the <code>sys_errlist</code>, but no message is available for the particular
error number, then returns the string &lsquo;<samp>Error <var>num</var></samp>&rsquo;, where
<var>num</var> is the error number.
</p>
<p>If the supplied error number is not a valid index into
<code>sys_errlist</code>, returns <code>NULL</code>.
</p>
<p>The returned string is only guaranteed to be valid only until the
next call to <code>strerror</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-strncasecmp"></a>Supplemental: <em>int</em> <strong>strncasecmp</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>)</em></dt>
<dd>
<p>A case-insensitive <code>strncmp</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-strncmp"></a>Supplemental: <em>int</em> <strong>strncmp</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>, size_t <var>n</var>)</em></dt>
<dd>
<p>Compares the first <var>n</var> bytes of two strings, returning a value as
<code>strcmp</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-strndup"></a>Extension: <em>char*</em> <strong>strndup</strong> <em>(const char *<var>s</var>, size_t <var>n</var>)</em></dt>
<dd>
<p>Returns a pointer to a copy of <var>s</var> with at most <var>n</var> characters
in memory obtained from <code>malloc</code>, or <code>NULL</code> if insufficient
memory was available. The result is always NUL terminated.
</p>
</dd></dl>
<dl>
<dt><a name="index-strnlen"></a>Supplemental: <em>size_t</em> <strong>strnlen</strong> <em>(const char *<var>s</var>, size_t <var>maxlen</var>)</em></dt>
<dd>
<p>Returns the length of <var>s</var>, as with <code>strlen</code>, but never looks
past the first <var>maxlen</var> characters in the string. If there is no
&rsquo;\0&rsquo; character in the first <var>maxlen</var> characters, returns
<var>maxlen</var>.
</p>
</dd></dl>
<dl>
<dt><a name="index-strrchr"></a>Supplemental: <em>char*</em> <strong>strrchr</strong> <em>(const char *<var>s</var>, int <var>c</var>)</em></dt>
<dd>
<p>Returns a pointer to the last occurrence of the character <var>c</var> in
the string <var>s</var>, or <code>NULL</code> if not found. If <var>c</var> is itself the
null character, the results are undefined.
</p>
</dd></dl>
<dl>
<dt><a name="index-strsignal"></a>Supplemental: <em>const char *</em> <strong>strsignal</strong> <em>(int <var>signo</var>)</em></dt>
<dd>
<p>Maps an signal number to an signal message string, the contents of
which are implementation defined. On systems which have the external
variable <code>sys_siglist</code>, these strings will be the same as the
ones used by <code>psignal()</code>.
</p>
<p>If the supplied signal number is within the valid range of indices for
the <code>sys_siglist</code>, but no message is available for the particular
signal number, then returns the string &lsquo;<samp>Signal <var>num</var></samp>&rsquo;, where
<var>num</var> is the signal number.
</p>
<p>If the supplied signal number is not a valid index into
<code>sys_siglist</code>, returns <code>NULL</code>.
</p>
<p>The returned string is only guaranteed to be valid only until the next
call to <code>strsignal</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-strsigno"></a>Extension: <em>const char*</em> <strong>strsigno</strong> <em>(int <var>signo</var>)</em></dt>
<dd>
<p>Given an signal number, returns a pointer to a string containing the
symbolic name of that signal number, as found in <code>&lt;signal.h&gt;</code>.
</p>
<p>If the supplied signal number is within the valid range of indices for
symbolic names, but no name is available for the particular signal
number, then returns the string &lsquo;<samp>Signal <var>num</var></samp>&rsquo;, where
<var>num</var> is the signal number.
</p>
<p>If the supplied signal number is not within the range of valid
indices, then returns <code>NULL</code>.
</p>
<p>The contents of the location pointed to are only guaranteed to be
valid until the next call to <code>strsigno</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-strstr"></a>Supplemental: <em>char*</em> <strong>strstr</strong> <em>(const char *<var>string</var>, const char *<var>sub</var>)</em></dt>
<dd>
<p>This function searches for the substring <var>sub</var> in the string
<var>string</var>, not including the terminating null characters. A pointer
to the first occurrence of <var>sub</var> is returned, or <code>NULL</code> if the
substring is absent. If <var>sub</var> points to a string with zero
length, the function returns <var>string</var>.
</p>
</dd></dl>
<dl>
<dt><a name="index-strtod"></a>Supplemental: <em>double</em> <strong>strtod</strong> <em>(const char *<var>string</var>, char **<var>endptr</var>)</em></dt>
<dd>
<p>This ISO C function converts the initial portion of <var>string</var> to a
<code>double</code>. If <var>endptr</var> is not <code>NULL</code>, a pointer to the
character after the last character used in the conversion is stored in
the location referenced by <var>endptr</var>. If no conversion is
performed, zero is returned and the value of <var>string</var> is stored in
the location referenced by <var>endptr</var>.
</p>
</dd></dl>
<dl>
<dt><a name="index-strtoerrno"></a>Extension: <em>int</em> <strong>strtoerrno</strong> <em>(const char *<var>name</var>)</em></dt>
<dd>
<p>Given the symbolic name of a error number (e.g., <code>EACCES</code>), map it
to an errno value. If no translation is found, returns 0.
</p>
</dd></dl>
<dl>
<dt><a name="index-strtol"></a>Supplemental: <em>long int</em> <strong>strtol</strong> <em>(const char *<var>string</var>, char **<var>endptr</var>, int <var>base</var>)</em></dt>
<dt><a name="index-strtoul"></a>Supplemental: <em>unsigned long int</em> <strong>strtoul</strong> <em>(const char *<var>string</var>, char **<var>endptr</var>, int <var>base</var>)</em></dt>
<dd>
<p>The <code>strtol</code> function converts the string in <var>string</var> to a
long integer value according to the given <var>base</var>, which must be
between 2 and 36 inclusive, or be the special value 0. If <var>base</var>
is 0, <code>strtol</code> will look for the prefixes <code>0</code> and <code>0x</code>
to indicate bases 8 and 16, respectively, else default to base 10.
When the base is 16 (either explicitly or implicitly), a prefix of
<code>0x</code> is allowed. The handling of <var>endptr</var> is as that of
<code>strtod</code> above. The <code>strtoul</code> function is the same, except
that the converted value is unsigned.
</p>
</dd></dl>
<dl>
<dt><a name="index-strtoll"></a>Supplemental: <em>long long int</em> <strong>strtoll</strong> <em>(const char *<var>string</var>, char **<var>endptr</var>, int <var>base</var>)</em></dt>
<dt><a name="index-strtoul-1"></a>Supplemental: <em>unsigned long long int</em> <strong>strtoul</strong> <em>( const char *<var>string</var>, char **<var>endptr</var>, int <var>base</var>)</em></dt>
<dd>
<p>The <code>strtoll</code> function converts the string in <var>string</var> to a
long long integer value according to the given <var>base</var>, which must be
between 2 and 36 inclusive, or be the special value 0. If <var>base</var>
is 0, <code>strtoll</code> will look for the prefixes <code>0</code> and <code>0x</code>
to indicate bases 8 and 16, respectively, else default to base 10.
When the base is 16 (either explicitly or implicitly), a prefix of
<code>0x</code> is allowed. The handling of <var>endptr</var> is as that of
<code>strtod</code> above. The <code>strtoull</code> function is the same, except
that the converted value is unsigned.
</p>
</dd></dl>
<dl>
<dt><a name="index-strtosigno"></a>Extension: <em>int</em> <strong>strtosigno</strong> <em>(const char *<var>name</var>)</em></dt>
<dd>
<p>Given the symbolic name of a signal, map it to a signal number. If no
translation is found, returns 0.
</p>
</dd></dl>
<dl>
<dt><a name="index-strverscmp"></a>Function: <em>int</em> <strong>strverscmp</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>)</em></dt>
<dd><p>The <code>strverscmp</code> function compares the string <var>s1</var> against
<var>s2</var>, considering them as holding indices/version numbers. Return
value follows the same conventions as found in the <code>strverscmp</code>
function. In fact, if <var>s1</var> and <var>s2</var> contain no digits,
<code>strverscmp</code> behaves like <code>strcmp</code>.
</p>
<p>Basically, we compare strings normally (character by character), until
we find a digit in each string - then we enter a special comparison
mode, where each sequence of digits is taken as a whole. If we reach the
end of these two parts without noticing a difference, we return to the
standard comparison mode. There are two types of numeric parts:
&quot;integral&quot; and &quot;fractional&quot; (those begin with a &rsquo;0&rsquo;). The types
of the numeric parts affect the way we sort them:
</p>
<ul>
<li> integral/integral: we compare values as you would expect.
</li><li> fractional/integral: the fractional part is less than the integral one.
Again, no surprise.
</li><li> fractional/fractional: the things become a bit more complex.
If the common prefix contains only leading zeroes, the longest part is less
than the other one; else the comparison behaves normally.
</li></ul>
<div class="smallexample">
<pre class="smallexample">strverscmp (&quot;no digit&quot;, &quot;no digit&quot;)
&rArr; 0 // <span class="roman">same behavior as strcmp.</span>
strverscmp (&quot;item#99&quot;, &quot;item#100&quot;)
&rArr; &lt;0 // <span class="roman">same prefix, but 99 &lt; 100.</span>
strverscmp (&quot;alpha1&quot;, &quot;alpha001&quot;)
&rArr; &gt;0 // <span class="roman">fractional part inferior to integral one.</span>
strverscmp (&quot;part1_f012&quot;, &quot;part1_f01&quot;)
&rArr; &gt;0 // <span class="roman">two fractional parts.</span>
strverscmp (&quot;foo.009&quot;, &quot;foo.0&quot;)
&rArr; &lt;0 // <span class="roman">idem, but with leading zeroes only.</span>
</pre></div>
<p>This function is especially useful when dealing with filename sorting,
because filenames frequently hold indices/version numbers.
</p></dd></dl>
<dl>
<dt><a name="index-timeval_005fadd"></a>Extension: <em>void</em> <strong>timeval_add</strong> <em>(struct timeval *<var>a</var>, struct timeval *<var>b</var>, struct timeval *<var>result</var>)</em></dt>
<dd>
<p>Adds <var>a</var> to <var>b</var> and stores the result in <var>result</var>.
</p>
</dd></dl>
<dl>
<dt><a name="index-timeval_005fsub"></a>Extension: <em>void</em> <strong>timeval_sub</strong> <em>(struct timeval *<var>a</var>, struct timeval *<var>b</var>, struct timeval *<var>result</var>)</em></dt>
<dd>
<p>Subtracts <var>b</var> from <var>a</var> and stores the result in <var>result</var>.
</p>
</dd></dl>
<dl>
<dt><a name="index-tmpnam"></a>Supplemental: <em>char*</em> <strong>tmpnam</strong> <em>(char *<var>s</var>)</em></dt>
<dd>
<p>This function attempts to create a name for a temporary file, which
will be a valid file name yet not exist when <code>tmpnam</code> checks for
it. <var>s</var> must point to a buffer of at least <code>L_tmpnam</code> bytes,
or be <code>NULL</code>. Use of this function creates a security risk, and it must
not be used in new projects. Use <code>mkstemp</code> instead.
</p>
</dd></dl>
<dl>
<dt><a name="index-unlink_005fif_005fordinary"></a>Supplemental: <em>int</em> <strong>unlink_if_ordinary</strong> <em>(const char*)</em></dt>
<dd>
<p>Unlinks the named file, unless it is special (e.g. a device file).
Returns 0 when the file was unlinked, a negative value (and errno set) when
there was an error deleting the file, and a positive value if no attempt
was made to unlink the file because it is special.
</p>
</dd></dl>
<dl>
<dt><a name="index-unlock_005fstd_005fstreams"></a>Extension: <em>void</em> <strong>unlock_std_streams</strong> <em>(void)</em></dt>
<dd>
<p>If the OS supports it, ensure that the standard I/O streams,
<code>stdin</code>, <code>stdout</code> and <code>stderr</code> are setup to avoid any
multi-threaded locking. Otherwise do nothing.
</p>
</dd></dl>
<dl>
<dt><a name="index-unlock_005fstream"></a>Extension: <em>void</em> <strong>unlock_stream</strong> <em>(FILE * <var>stream</var>)</em></dt>
<dd>
<p>If the OS supports it, ensure that the supplied stream is setup to
avoid any multi-threaded locking. Otherwise leave the <code>FILE</code>
pointer unchanged. If the <var>stream</var> is <code>NULL</code> do nothing.
</p>
</dd></dl>
<dl>
<dt><a name="index-vasprintf"></a>Extension: <em>int</em> <strong>vasprintf</strong> <em>(char **<var>resptr</var>, const char *<var>format</var>, va_list <var>args</var>)</em></dt>
<dd>
<p>Like <code>vsprintf</code>, but instead of passing a pointer to a buffer,
you pass a pointer to a pointer. This function will compute the size
of the buffer needed, allocate memory with <code>malloc</code>, and store a
pointer to the allocated memory in <code>*<var>resptr</var></code>. The value
returned is the same as <code>vsprintf</code> would return. If memory could
not be allocated, minus one is returned and <code>NULL</code> is stored in
<code>*<var>resptr</var></code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-vfork"></a>Supplemental: <em>int</em> <strong>vfork</strong> <em>(void)</em></dt>
<dd>
<p>Emulates <code>vfork</code> by calling <code>fork</code> and returning its value.
</p>
</dd></dl>
<dl>
<dt><a name="index-vprintf"></a>Supplemental: <em>int</em> <strong>vprintf</strong> <em>(const char *<var>format</var>, va_list <var>ap</var>)</em></dt>
<dt><a name="index-vfprintf"></a>Supplemental: <em>int</em> <strong>vfprintf</strong> <em>(FILE *<var>stream</var>, const char *<var>format</var>, va_list <var>ap</var>)</em></dt>
<dt><a name="index-vsprintf"></a>Supplemental: <em>int</em> <strong>vsprintf</strong> <em>(char *<var>str</var>, const char *<var>format</var>, va_list <var>ap</var>)</em></dt>
<dd>
<p>These functions are the same as <code>printf</code>, <code>fprintf</code>, and
<code>sprintf</code>, respectively, except that they are called with a
<code>va_list</code> instead of a variable number of arguments. Note that
they do not call <code>va_end</code>; this is the application&rsquo;s
responsibility. In <code>libiberty</code> they are implemented in terms of the
nonstandard but common function <code>_doprnt</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-vsnprintf"></a>Supplemental: <em>int</em> <strong>vsnprintf</strong> <em>(char *<var>buf</var>, size_t <var>n</var>, const char *<var>format</var>, va_list <var>ap</var>)</em></dt>
<dd>
<p>This function is similar to <code>vsprintf</code>, but it will write to
<var>buf</var> at most <code><var>n</var>-1</code> bytes of text, followed by a
terminating null byte, for a total of <var>n</var> bytes. On error the
return value is -1, otherwise it returns the number of characters that
would have been printed had <var>n</var> been sufficiently large,
regardless of the actual value of <var>n</var>. Note some pre-C99 system
libraries do not implement this correctly so users cannot generally
rely on the return value if the system version of this function is
used.
</p>
</dd></dl>
<dl>
<dt><a name="index-waitpid"></a>Supplemental: <em>int</em> <strong>waitpid</strong> <em>(int <var>pid</var>, int *<var>status</var>, int)</em></dt>
<dd>
<p>This is a wrapper around the <code>wait</code> function. Any &ldquo;special&rdquo;
values of <var>pid</var> depend on your implementation of <code>wait</code>, as
does the return value. The third argument is unused in <code>libiberty</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-writeargv"></a>Extension: <em>int</em> <strong>writeargv</strong> <em>(const char **<var>argv</var>, FILE *<var>file</var>)</em></dt>
<dd>
<p>Write each member of ARGV, handling all necessary quoting, to the file
named by FILE, separated by whitespace. Return 0 on success, non-zero
if an error occurred while writing to FILE.
</p>
</dd></dl>
<dl>
<dt><a name="index-xasprintf"></a>Replacement: <em>char*</em> <strong>xasprintf</strong> <em>(const char *<var>format</var>, ...)</em></dt>
<dd>
<p>Print to allocated string without fail. If <code>xasprintf</code> fails,
this will print a message to <code>stderr</code> (using the name set by
<code>xmalloc_set_program_name</code>, if any) and then call <code>xexit</code>.
</p>
</dd></dl>
<dl>
<dt><a name="index-xatexit"></a>Function: <em>int</em> <strong>xatexit</strong> <em>(void (*<var>fn</var>) (void))</em></dt>
<dd>
<p>Behaves as the standard <code>atexit</code> function, but with no limit on
the number of registered functions. Returns 0 on success, or -1 on
failure. If you use <code>xatexit</code> to register functions, you must use
<code>xexit</code> to terminate your program.
</p>
</dd></dl>
<dl>
<dt><a name="index-xcalloc"></a>Replacement: <em>void*</em> <strong>xcalloc</strong> <em>(size_t <var>nelem</var>, size_t <var>elsize</var>)</em></dt>
<dd>
<p>Allocate memory without fail, and set it to zero. This routine functions
like <code>calloc</code>, but will behave the same as <code>xmalloc</code> if memory
cannot be found.
</p>
</dd></dl>
<dl>
<dt><a name="index-xexit"></a>Replacement: <em>void</em> <strong>xexit</strong> <em>(int <var>code</var>)</em></dt>
<dd>
<p>Terminates the program. If any functions have been registered with
the <code>xatexit</code> replacement function, they will be called first.
Termination is handled via the system&rsquo;s normal <code>exit</code> call.
</p>
</dd></dl>
<dl>
<dt><a name="index-xmalloc"></a>Replacement: <em>void*</em> <strong>xmalloc</strong> <em>(size_t)</em></dt>
<dd>
<p>Allocate memory without fail. If <code>malloc</code> fails, this will print
a message to <code>stderr</code> (using the name set by
<code>xmalloc_set_program_name</code>,
if any) and then call <code>xexit</code>. Note that it is therefore safe for
a program to contain <code>#define malloc xmalloc</code> in its source.
</p>
</dd></dl>
<dl>
<dt><a name="index-xmalloc_005ffailed"></a>Replacement: <em>void</em> <strong>xmalloc_failed</strong> <em>(size_t)</em></dt>
<dd>
<p>This function is not meant to be called by client code, and is listed
here for completeness only. If any of the allocation routines fail, this
function will be called to print an error message and terminate execution.
</p>
</dd></dl>
<dl>
<dt><a name="index-xmalloc_005fset_005fprogram_005fname"></a>Replacement: <em>void</em> <strong>xmalloc_set_program_name</strong> <em>(const char *<var>name</var>)</em></dt>
<dd>
<p>You can use this to set the name of the program used by
<code>xmalloc_failed</code> when printing a failure message.
</p>
</dd></dl>
<dl>
<dt><a name="index-xmemdup"></a>Replacement: <em>void*</em> <strong>xmemdup</strong> <em>(void *<var>input</var>, size_t <var>copy_size</var>, size_t <var>alloc_size</var>)</em></dt>
<dd>
<p>Duplicates a region of memory without fail. First, <var>alloc_size</var> bytes
are allocated, then <var>copy_size</var> bytes from <var>input</var> are copied into
it, and the new memory is returned. If fewer bytes are copied than were
allocated, the remaining memory is zeroed.
</p>
</dd></dl>
<dl>
<dt><a name="index-xrealloc"></a>Replacement: <em>void*</em> <strong>xrealloc</strong> <em>(void *<var>ptr</var>, size_t <var>size</var>)</em></dt>
<dd><p>Reallocate memory without fail. This routine functions like <code>realloc</code>,
but will behave the same as <code>xmalloc</code> if memory cannot be found.
</p>
</dd></dl>
<dl>
<dt><a name="index-xstrdup"></a>Replacement: <em>char*</em> <strong>xstrdup</strong> <em>(const char *<var>s</var>)</em></dt>
<dd>
<p>Duplicates a character string without fail, using <code>xmalloc</code> to
obtain memory.
</p>
</dd></dl>
<dl>
<dt><a name="index-xstrerror"></a>Replacement: <em>char*</em> <strong>xstrerror</strong> <em>(int <var>errnum</var>)</em></dt>
<dd>
<p>Behaves exactly like the standard <code>strerror</code> function, but
will never return a <code>NULL</code> pointer.
</p>
</dd></dl>
<dl>
<dt><a name="index-xstrndup"></a>Replacement: <em>char*</em> <strong>xstrndup</strong> <em>(const char *<var>s</var>, size_t <var>n</var>)</em></dt>
<dd>
<p>Returns a pointer to a copy of <var>s</var> with at most <var>n</var> characters
without fail, using <code>xmalloc</code> to obtain memory. The result is
always NUL terminated.
</p>
</dd></dl>
<dl>
<dt><a name="index-xvasprintf"></a>Replacement: <em>char*</em> <strong>xvasprintf</strong> <em>(const char *<var>format</var>, va_list <var>args</var>)</em></dt>
<dd>
<p>Print to allocated string without fail. If <code>xvasprintf</code> fails,
this will print a message to <code>stderr</code> (using the name set by
<code>xmalloc_set_program_name</code>, if any) and then call <code>xexit</code>.
</p>
</dd></dl>
<hr>
<a name="Licenses"></a>
<div class="header">
<p>
Next: <a href="#Index" accesskey="n" rel="next">Index</a>, Previous: <a href="#Functions" accesskey="p" rel="prev">Functions</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Licenses-1"></a>
<h2 class="appendix">Appendix A Licenses</h2>
<table class="menu" border="0" cellspacing="0">
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
</pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Library-Copying" accesskey="1">Library Copying</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">The GNU Library General Public License
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#BSD" accesskey="2">BSD</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Regents of the University of California
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
</pre></th></tr></table>
<hr>
<a name="Library-Copying"></a>
<div class="header">
<p>
Next: <a href="#BSD" accesskey="n" rel="next">BSD</a>, Up: <a href="#Licenses" accesskey="u" rel="up">Licenses</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="GNU-LESSER-GENERAL-PUBLIC-LICENSE"></a>
<h3 class="appendixsec">A.1 GNU LESSER GENERAL PUBLIC LICENSE</h3>
<a name="index-LGPL_002c-Lesser-General-Public-License"></a>
<div align="center">Version 2.1, February 1999
</div>
<div class="display">
<pre class="display">Copyright &copy; 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence the
version number 2.1.]
</pre></div>
<a name="Preamble"></a>
<h4 class="appendixsubsec">A.1.1 Preamble</h4>
<p>The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software&mdash;to make sure the software is free for all its users.
</p>
<p>This license, the Lesser General Public License, applies to some
specially designated software&mdash;typically libraries&mdash;of the Free
Software Foundation and other authors who decide to use it. You can use
it too, but we suggest you first think carefully about whether this
license or the ordinary General Public License is the better strategy to
use in any particular case, based on the explanations below.
</p>
<p>When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of it
in new free programs; and that you are informed that you can do these
things.
</p>
<p>To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
</p>
<p>For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
</p>
<p>We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
</p>
<p>To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author&rsquo;s reputation will not be affected by problems that might be
introduced by others.
</p>
<p>Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
</p>
<p>Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
</p>
<p>When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
</p>
<p>We call this license the <em>Lesser</em> General Public License because it
does <em>Less</em> to protect the user&rsquo;s freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
</p>
<p>For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
</p>
<p>In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
</p>
<p>Although the Lesser General Public License is Less protective of the
users&rsquo; freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
</p>
<p>The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
&ldquo;work based on the library&rdquo; and a &ldquo;work that uses the library&rdquo;. The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
</p>
<ol>
<li> This License Agreement applies to any software library or other program
which contains a notice placed by the copyright holder or other
authorized party saying it may be distributed under the terms of this
Lesser General Public License (also called &ldquo;this License&rdquo;). Each
licensee is addressed as &ldquo;you&rdquo;.
<p>A &ldquo;library&rdquo; means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
</p>
<p>The &ldquo;Library&rdquo;, below, refers to any such software library or work
which has been distributed under these terms. A &ldquo;work based on the
Library&rdquo; means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term &ldquo;modification&rdquo;.)
</p>
<p>&ldquo;Source code&rdquo; for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
</p>
<p>Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
</p>
</li><li> You may copy and distribute verbatim copies of the Library&rsquo;s
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
<p>You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
</p>
</li><li> You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
<ol>
<li> The modified work must itself be a software library.
</li><li> You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
</li><li> You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
</li><li> If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
<p>(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
</p></li></ol>
<p>These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
</p>
<p>Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
</p>
<p>In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
</p>
</li><li> You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
<p>Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
</p>
<p>This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
</p>
</li><li> You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
<p>If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
</p>
</li><li> A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a &ldquo;work that uses the Library&rdquo;. Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
<p>However, linking a &ldquo;work that uses the Library&rdquo; with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a &ldquo;work that uses the
library&rdquo;. The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
</p>
<p>When a &ldquo;work that uses the Library&rdquo; uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
</p>
<p>If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
</p>
<p>Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
</p>
</li><li> As an exception to the Sections above, you may also combine or
link a &ldquo;work that uses the Library&rdquo; with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer&rsquo;s own use and reverse
engineering for debugging such modifications.
<p>You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
</p>
<ol>
<li> Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable &ldquo;work that
uses the Library&rdquo;, as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
</li><li> Use a suitable shared library mechanism for linking with the Library. A
suitable mechanism is one that (1) uses at run time a copy of the
library already present on the user&rsquo;s computer system, rather than
copying library functions into the executable, and (2) will operate
properly with a modified version of the library, if the user installs
one, as long as the modified version is interface-compatible with the
version that the work was made with.
</li><li> Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
</li><li> If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
</li><li> Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
</li></ol>
<p>For an executable, the required form of the &ldquo;work that uses the
Library&rdquo; must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies the
executable.
</p>
<p>It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
</p>
</li><li> You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
<ol>
<li> Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
</li><li> Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
</li></ol>
</li><li> You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
</li><li> You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
</li><li> Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients&rsquo; exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
</li><li> If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
<p>If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
</p>
<p>It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
</p>
<p>This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
</p>
</li><li> If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
</li><li> The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
<p>Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
&ldquo;any later version&rdquo;, you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
</p>
</li><li> If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
<div align="center">NO WARRANTY
</div>
</li><li> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY &ldquo;AS IS&rdquo; WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
</li><li> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
</li></ol>
<a name="How-to-Apply-These-Terms-to-Your-New-Libraries"></a>
<h4 class="appendixsubsec">A.1.2 How to Apply These Terms to Your New Libraries</h4>
<p>If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
</p>
<p>To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
&ldquo;copyright&rdquo; line and a pointer to where the full notice is found.
</p>
<div class="smallexample">
<pre class="smallexample"><var>one line to give the library's name and an idea of what it does.</var>
Copyright (C) <var>year</var> <var>name of author</var>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
</pre></div>
<p>Also add information on how to contact you by electronic and paper mail.
</p>
<p>You should also get your employer (if you work as a programmer) or your
school, if any, to sign a &ldquo;copyright disclaimer&rdquo; for the library, if
necessary. Here is a sample; alter the names:
</p>
<div class="smallexample">
<pre class="smallexample">Yoyodyne, Inc., hereby disclaims all copyright interest in the library
`Frob' (a library for tweaking knobs) written by James Random Hacker.
<var>signature of Ty Coon</var>, 1 April 1990
Ty Coon, President of Vice
</pre></div>
<p>That&rsquo;s all there is to it!
</p>
<hr>
<a name="BSD"></a>
<div class="header">
<p>
Previous: <a href="#Library-Copying" accesskey="p" rel="prev">Library Copying</a>, Up: <a href="#Licenses" accesskey="u" rel="up">Licenses</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="BSD-1"></a>
<h3 class="appendixsec">A.2 BSD</h3>
<p>Copyright &copy; 1990 Regents of the University of California.
All rights reserved.
</p>
<p>Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
</p>
<ol>
<li> Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
</li><li> 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.
</li><li> [rescinded 22 July 1999]
</li><li> 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.
</li></ol>
<p>THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS &ldquo;AS IS&rdquo; 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 REGENTS 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.
</p>
<hr>
<a name="Index"></a>
<div class="header">
<p>
Previous: <a href="#Licenses" accesskey="p" rel="prev">Licenses</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Index-1"></a>
<h2 class="unnumbered">Index</h2>
<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Index_cp_letter-A"><b>A</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-B"><b>B</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-C"><b>C</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-D"><b>D</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-E"><b>E</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-F"><b>F</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-G"><b>G</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-H"><b>H</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-I"><b>I</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-L"><b>L</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-M"><b>M</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-O"><b>O</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-P"><b>P</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-R"><b>R</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-S"><b>S</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-T"><b>T</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-U"><b>U</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-V"><b>V</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-W"><b>W</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-X"><b>X</b></a>
&nbsp;
</td></tr></table>
<table class="index-cp" border="0">
<tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-A">A</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-alignment-_0028in-obstacks_0029">alignment (in obstacks)</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstacks-Data-Alignment">Obstacks Data Alignment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-alloca"><code>alloca</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-allocation-_0028obstacks_0029">allocation (obstacks)</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-asprintf"><code>asprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-atexit"><code>atexit</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-B">B</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-basename"><code>basename</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bcmp"><code>bcmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bcopy"><code>bcopy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bsearch"><code>bsearch</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-buildargv"><code>buildargv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bzero"><code>bzero</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-C">C</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-calloc"><code>calloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-canonical_005ffilename_005feq"><code>canonical_filename_eq</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-changing-the-size-of-a-block-_0028obstacks_0029">changing the size of a block (obstacks)</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_002a"><code>char*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-choose_005ftemp_005fbase"><code>choose_temp_base</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-chunks">chunks</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstack-Chunks">Obstack Chunks</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-clock"><code>clock</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-concat"><code>concat</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-countargv"><code>countargv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-crc32"><code>crc32</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-D">D</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-dupargv"><code>dupargv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-E">E</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-efficiency-and-obstacks">efficiency and obstacks</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extra-Fast-Growing">Extra Fast Growing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-efficiency-of-chunks">efficiency of chunks</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstack-Chunks">Obstack Chunks</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-errno_005fmax"><code>errno_max</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-error-reporting">error reporting</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Error-Reporting">Error Reporting</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-exit-handlers">exit handlers</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Exit-Handlers">Exit Handlers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-expandargv"><code>expandargv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-extensions">extensions</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensions">Extensions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-F">F</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-fdmatch"><code>fdmatch</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fdopen_005funlocked"><code>fdopen_unlocked</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ffs"><code>ffs</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-filename_005fcmp"><code>filename_cmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-filename_005feq"><code>filename_eq</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-filename_005fhash"><code>filename_hash</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-filename_005fncmp"><code>filename_ncmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fnmatch"><code>fnmatch</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fopen_005funlocked"><code>fopen_unlocked</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-freeargv"><code>freeargv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-freeing-_0028obstacks_0029">freeing (obstacks)</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Freeing-Obstack-Objects">Freeing Obstack Objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-freopen_005funlocked"><code>freopen_unlocked</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-functions_002c-extension">functions, extension</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensions">Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-functions_002c-missing">functions, missing</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Supplemental-Functions">Supplemental Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-functions_002c-replacement">functions, replacement</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Replacement-Functions">Replacement Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-functions_002c-supplemental">functions, supplemental</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Supplemental-Functions">Supplemental Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-G">G</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-getcwd"><code>getcwd</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-getpagesize"><code>getpagesize</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-getpwd"><code>getpwd</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gettimeofday"><code>gettimeofday</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-get_005frun_005ftime"><code>get_run_time</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-growing-objects-_0028in-obstacks_0029">growing objects (in obstacks)</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-H">H</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-hex_005finit"><code>hex_init</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-hex_005fp"><code>hex_p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-hex_005fvalue"><code>hex_value</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-HOST_005fCHARSET"><code>HOST_CHARSET</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-HOST_005fCHARSET_005fASCII"><code>HOST_CHARSET_ASCII</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-HOST_005fCHARSET_005fEBCDIC"><code>HOST_CHARSET_EBCDIC</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-HOST_005fCHARSET_005fUNKNOWN"><code>HOST_CHARSET_UNKNOWN</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-how-to-use">how to use</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using">Using</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-htab_005fcreate_005ftyped_005falloc"><code>htab_create_typed_alloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-I">I</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-index"><code>index</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-initstate"><code>initstate</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-insque"><code>insque</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISALNUM"><code>ISALNUM</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISALPHA"><code>ISALPHA</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISBLANK"><code>ISBLANK</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISCNTRL"><code>ISCNTRL</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISDIGIT"><code>ISDIGIT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISGRAPH"><code>ISGRAPH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISIDNUM"><code>ISIDNUM</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISIDST"><code>ISIDST</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISLOWER"><code>ISLOWER</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISPRINT"><code>ISPRINT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISPUNCT"><code>ISPUNCT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISSPACE"><code>ISSPACE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISUPPER"><code>ISUPPER</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ISXDIGIT"><code>ISXDIGIT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-IS_005fISOBASIC"><code>IS_ISOBASIC</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-IS_005fNVSPACE"><code>IS_NVSPACE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-IS_005fSPACE_005fOR_005fNUL"><code>IS_SPACE_OR_NUL</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-IS_005fVSPACE"><code>IS_VSPACE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-L">L</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-lbasename"><code>lbasename</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-LGPL_002c-Lesser-General-Public-License">LGPL, Lesser General Public License</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Library-Copying">Library Copying</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-libiberty-usage">libiberty usage</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using">Using</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-lrealpath"><code>lrealpath</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-M">M</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-macros">macros</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstack-Functions">Obstack Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_005frelative_005fprefix"><code>make_relative_prefix</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_005ftemp_005ffile"><code>make_temp_file</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-memchr"><code>memchr</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-memcmp"><code>memcmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-memcpy"><code>memcpy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-memmem"><code>memmem</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-memmove"><code>memmove</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-memory-allocation">memory allocation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Memory-Allocation">Memory Allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mempcpy"><code>mempcpy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-memset"><code>memset</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mkstemps"><code>mkstemps</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-O">O</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack-status">obstack status</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Status-of-an-Obstack">Status of an Obstack</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_002eh"><code>obstack.h</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Creating-Obstacks">Creating Obstacks</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstacks">obstacks</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstacks">Obstacks</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005f1grow"><code>obstack_1grow</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005f1grow_005ffast"><code>obstack_1grow_fast</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extra-Fast-Growing">Extra Fast Growing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005falignment_005fmask"><code>obstack_alignment_mask</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstacks-Data-Alignment">Obstacks Data Alignment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005falloc"><code>obstack_alloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005falloc_005ffailed_005fhandler"><code>obstack_alloc_failed_handler</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Preparing-for-Obstacks">Preparing for Obstacks</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fbase"><code>obstack_base</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Status-of-an-Obstack">Status of an Obstack</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fblank"><code>obstack_blank</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fblank_005ffast"><code>obstack_blank_fast</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extra-Fast-Growing">Extra Fast Growing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fchunk_005falloc"><code>obstack_chunk_alloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Preparing-for-Obstacks">Preparing for Obstacks</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fchunk_005ffree"><code>obstack_chunk_free</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Preparing-for-Obstacks">Preparing for Obstacks</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fchunk_005fsize"><code>obstack_chunk_size</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstack-Chunks">Obstack Chunks</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fcopy"><code>obstack_copy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fcopy0"><code>obstack_copy0</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005ffinish"><code>obstack_finish</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005ffree"><code>obstack_free</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Freeing-Obstack-Objects">Freeing Obstack Objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fgrow"><code>obstack_grow</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fgrow0"><code>obstack_grow0</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005finit"><code>obstack_init</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Preparing-for-Obstacks">Preparing for Obstacks</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fint_005fgrow"><code>obstack_int_grow</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fint_005fgrow_005ffast"><code>obstack_int_grow_fast</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extra-Fast-Growing">Extra Fast Growing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fnext_005ffree"><code>obstack_next_free</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Status-of-an-Obstack">Status of an Obstack</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fobject_005fsize"><code>obstack_object_size</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fobject_005fsize-1"><code>obstack_object_size</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Status-of-an-Obstack">Status of an Obstack</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fptr_005fgrow"><code>obstack_ptr_grow</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005fptr_005fgrow_005ffast"><code>obstack_ptr_grow_fast</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extra-Fast-Growing">Extra Fast Growing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-obstack_005froom"><code>obstack_room</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extra-Fast-Growing">Extra Fast Growing</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-P">P</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-pexecute"><code>pexecute</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PEX_005fBINARY_005fERROR"><code>PEX_BINARY_ERROR</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PEX_005fBINARY_005fINPUT"><code>PEX_BINARY_INPUT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PEX_005fBINARY_005fOUTPUT"><code>PEX_BINARY_OUTPUT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pex_005ffree"><code>pex_free</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pex_005fget_005fstatus"><code>pex_get_status</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pex_005fget_005ftimes"><code>pex_get_times</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pex_005finit"><code>pex_init</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pex_005finput_005ffile"><code>pex_input_file</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pex_005finput_005fpipe"><code>pex_input_pipe</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PEX_005fLAST"><code>PEX_LAST</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pex_005fone"><code>pex_one</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pex_005fread_005ferr"><code>pex_read_err</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pex_005fread_005foutput"><code>pex_read_output</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PEX_005fRECORD_005fTIMES"><code>PEX_RECORD_TIMES</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pex_005frun"><code>pex_run</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pex_005frun_005fin_005fenvironment"><code>pex_run_in_environment</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PEX_005fSAVE_005fTEMPS"><code>PEX_SAVE_TEMPS</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PEX_005fSEARCH"><code>PEX_SEARCH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PEX_005fSTDERR_005fTO_005fPIPE"><code>PEX_STDERR_TO_PIPE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PEX_005fSTDERR_005fTO_005fSTDOUT"><code>PEX_STDERR_TO_STDOUT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PEX_005fSUFFIX"><code>PEX_SUFFIX</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PEX_005fUSE_005fPIPES"><code>PEX_USE_PIPES</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-psignal"><code>psignal</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-putenv"><code>putenv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pwait"><code>pwait</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-R">R</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-random"><code>random</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-reconcat"><code>reconcat</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-remque"><code>remque</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rename"><code>rename</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-replacement-functions">replacement functions</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Replacement-Functions">Replacement Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rindex"><code>rindex</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-S">S</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-setenv"><code>setenv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-setproctitle"><code>setproctitle</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-setstate"><code>setstate</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-shrinking-objects">shrinking objects</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-signo_005fmax"><code>signo_max</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sigsetmask"><code>sigsetmask</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-simple_005fobject_005fattributes_005fcompare"><code>simple_object_attributes_compare</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-simple_005fobject_005ffetch_005fattributes"><code>simple_object_fetch_attributes</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-simple_005fobject_005ffind_005fsection"><code>simple_object_find_section</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-simple_005fobject_005ffind_005fsections"><code>simple_object_find_sections</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-simple_005fobject_005fopen_005fread"><code>simple_object_open_read</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-simple_005fobject_005frelease_005fattributes"><code>simple_object_release_attributes</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-simple_005fobject_005frelease_005fread"><code>simple_object_release_read</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-simple_005fobject_005frelease_005fwrite"><code>simple_object_release_write</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-simple_005fobject_005fstart_005fwrite"><code>simple_object_start_write</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-simple_005fobject_005fwrite_005fadd_005fdata"><code>simple_object_write_add_data</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-simple_005fobject_005fwrite_005fcreate_005fsection"><code>simple_object_write_create_section</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-simple_005fobject_005fwrite_005fto_005ffile"><code>simple_object_write_to_file</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-snprintf"><code>snprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-spaces"><code>spaces</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-splay_005ftree_005fnew_005fwith_005ftyped_005falloc"><code>splay_tree_new_with_typed_alloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-srandom"><code>srandom</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stack_005flimit_005fincrease"><code>stack_limit_increase</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-status-of-obstack">status of obstack</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Status-of-an-Obstack">Status of an Obstack</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stpcpy"><code>stpcpy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stpncpy"><code>stpncpy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strcasecmp"><code>strcasecmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strchr"><code>strchr</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strdup"><code>strdup</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strerrno"><code>strerrno</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strerror"><code>strerror</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strncasecmp"><code>strncasecmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strncmp"><code>strncmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strndup"><code>strndup</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strnlen"><code>strnlen</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strrchr"><code>strrchr</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strsignal"><code>strsignal</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strsigno"><code>strsigno</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strstr"><code>strstr</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strtod"><code>strtod</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strtoerrno"><code>strtoerrno</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strtol"><code>strtol</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strtoll"><code>strtoll</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strtosigno"><code>strtosigno</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strtoul"><code>strtoul</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strtoul-1"><code>strtoul</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strverscmp"><code>strverscmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-supplemental-functions">supplemental functions</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Supplemental-Functions">Supplemental Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-T">T</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-timeval_005fadd"><code>timeval_add</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-timeval_005fsub"><code>timeval_sub</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tmpnam"><code>tmpnam</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-U">U</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-unlink_005fif_005fordinary"><code>unlink_if_ordinary</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unlock_005fstd_005fstreams"><code>unlock_std_streams</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unlock_005fstream"><code>unlock_stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unsetenv"><code>unsetenv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-using-libiberty">using libiberty</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using">Using</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-V">V</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-vasprintf"><code>vasprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-vfork"><code>vfork</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-vfprintf"><code>vfprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-vprintf"><code>vprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-vsnprintf"><code>vsnprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-vsprintf"><code>vsprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-W">W</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-waitpid"><code>waitpid</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-writeargv"><code>writeargv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-X">X</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-xasprintf"><code>xasprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-xatexit"><code>xatexit</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-xcalloc"><code>xcalloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-xexit"><code>xexit</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-xmalloc"><code>xmalloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-xmalloc_005ffailed"><code>xmalloc_failed</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-xmalloc_005fset_005fprogram_005fname"><code>xmalloc_set_program_name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-xmemdup"><code>xmemdup</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-xrealloc"><code>xrealloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-xstrdup"><code>xstrdup</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-xstrerror"><code>xstrerror</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-xstrndup"><code>xstrndup</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-xvasprintf"><code>xvasprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
</table>
<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Index_cp_letter-A"><b>A</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-B"><b>B</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-C"><b>C</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-D"><b>D</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-E"><b>E</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-F"><b>F</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-G"><b>G</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-H"><b>H</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-I"><b>I</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-L"><b>L</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-M"><b>M</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-O"><b>O</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-P"><b>P</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-R"><b>R</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-S"><b>S</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-T"><b>T</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-U"><b>U</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-V"><b>V</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-W"><b>W</b></a>
&nbsp;
<a class="summary-letter" href="#Index_cp_letter-X"><b>X</b></a>
&nbsp;
</td></tr></table>
<hr>
</body>
</html>