Sophie

Sophie

distrib > CentOS > 5 > x86_64 > by-pkgid > bdbf07027827e6ad7d9208f8a9eaea97 > files > 129

apr-docs-1.2.7-11.el5_6.5.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Apache Portable Runtime: Command Argument Parsing</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
    <li><a href="examples.html"><span>Examples</span></a></li>
  </ul></div>
<h1>Command Argument Parsing<br>
<small>
[<a class="el" href="group___a_p_r.html">Apache Portability Runtime library</a>]</small>
</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structapr__getopt__t.html">apr_getopt_t</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structapr__getopt__option__t.html">apr_getopt_option_t</a></td></tr>

<tr><td colspan="2"><br><h2>Typedefs</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef void(&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__getopt.html#g87430c13f1899c2ffae847db8c4b585d">apr_getopt_err_fn_t</a> )(void *arg, const char *err,...)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="structapr__getopt__t.html">apr_getopt_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__getopt.html#gcbc9bec15d6cec880fecef31abc98bcb">apr_getopt_t</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="structapr__getopt__option__t.html">apr_getopt_option_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__getopt.html#gde59c9a23f085e8b3316d27015de6f8c">apr_getopt_option_t</a></td></tr>

<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__getopt.html#gca3f4f3be0eb2e847c02e3af6c529e8c">apr_getopt_init</a> (<a class="el" href="structapr__getopt__t.html">apr_getopt_t</a> **os, <a class="el" href="group__apr__pools.html#g06f17a7732f2d04d8ce7010fbb057a8b">apr_pool_t</a> *cont, int argc, const char *const *argv)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__getopt.html#gbfd6c4ca03eff6fac2bea385fda08372">apr_getopt</a> (<a class="el" href="structapr__getopt__t.html">apr_getopt_t</a> *os, const char *opts, char *option_ch, const char **option_arg)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__getopt.html#g3f58acc4bf065e91300ca6d92e588a39">apr_getopt_long</a> (<a class="el" href="structapr__getopt__t.html">apr_getopt_t</a> *os, const <a class="el" href="structapr__getopt__option__t.html">apr_getopt_option_t</a> *opts, int *option_ch, const char **option_arg)</td></tr>

</table>
<hr><h2>Typedef Documentation</h2>
<a class="anchor" name="g87430c13f1899c2ffae847db8c4b585d"></a><!-- doxytag: member="apr_getopt.h::apr_getopt_err_fn_t" ref="g87430c13f1899c2ffae847db8c4b585d" args=")(void *arg, const char *err,...)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void( <a class="el" href="group__apr__getopt.html#g87430c13f1899c2ffae847db8c4b585d">apr_getopt_err_fn_t</a>)(void *arg, const char *err,...)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
defintion of a error function 
</div>
</div><p>
<a class="anchor" name="gde59c9a23f085e8b3316d27015de6f8c"></a><!-- doxytag: member="apr_getopt.h::apr_getopt_option_t" ref="gde59c9a23f085e8b3316d27015de6f8c" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="structapr__getopt__option__t.html">apr_getopt_option_t</a> <a class="el" href="structapr__getopt__option__t.html">apr_getopt_option_t</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="structapr__getopt__option__t.html">apr_getopt_option_t</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="gcbc9bec15d6cec880fecef31abc98bcb"></a><!-- doxytag: member="apr_getopt.h::apr_getopt_t" ref="gcbc9bec15d6cec880fecef31abc98bcb" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="structapr__getopt__t.html">apr_getopt_t</a> <a class="el" href="structapr__getopt__t.html">apr_getopt_t</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="structapr__getopt__t.html">apr_getopt_t</a> </dd></dl>

</div>
</div><p>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="gbfd6c4ca03eff6fac2bea385fda08372"></a><!-- doxytag: member="apr_getopt.h::apr_getopt" ref="gbfd6c4ca03eff6fac2bea385fda08372" args="(apr_getopt_t *os, const char *opts, char *option_ch, const char **option_arg)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a> apr_getopt           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structapr__getopt__t.html">apr_getopt_t</a> *&nbsp;</td>
          <td class="paramname"> <em>os</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>opts</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>option_ch</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char **&nbsp;</td>
          <td class="paramname"> <em>option_arg</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Parse the options initialized by <a class="el" href="group__apr__getopt.html#gca3f4f3be0eb2e847c02e3af6c529e8c">apr_getopt_init()</a>. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>os</em>&nbsp;</td><td>The apr_opt_t structure returned by <a class="el" href="group__apr__getopt.html#gca3f4f3be0eb2e847c02e3af6c529e8c">apr_getopt_init()</a> </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>opts</em>&nbsp;</td><td>A string of characters that are acceptable options to the program. Characters followed by ":" are required to have an option associated </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>option_ch</em>&nbsp;</td><td>The next option character parsed </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>option_arg</em>&nbsp;</td><td>The argument following the option character: </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>There are four potential status values on exit. They are: <pre>
             APR_EOF      --  No more options to parse
             APR_BADCH    --  Found a bad option character
             APR_BADARG   --  No argument followed the option flag
             APR_SUCCESS  --  The next option was found.
 </pre> </dd></dl>

</div>
</div><p>
<a class="anchor" name="gca3f4f3be0eb2e847c02e3af6c529e8c"></a><!-- doxytag: member="apr_getopt.h::apr_getopt_init" ref="gca3f4f3be0eb2e847c02e3af6c529e8c" args="(apr_getopt_t **os, apr_pool_t *cont, int argc, const char *const *argv)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a> apr_getopt_init           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structapr__getopt__t.html">apr_getopt_t</a> **&nbsp;</td>
          <td class="paramname"> <em>os</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__apr__pools.html#g06f17a7732f2d04d8ce7010fbb057a8b">apr_pool_t</a> *&nbsp;</td>
          <td class="paramname"> <em>cont</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>argc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *const *&nbsp;</td>
          <td class="paramname"> <em>argv</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Initialize the arguments for parsing by <a class="el" href="group__apr__getopt.html#gbfd6c4ca03eff6fac2bea385fda08372">apr_getopt()</a>. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>os</em>&nbsp;</td><td>The options structure created for <a class="el" href="group__apr__getopt.html#gbfd6c4ca03eff6fac2bea385fda08372">apr_getopt()</a> </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>cont</em>&nbsp;</td><td>The pool to operate on </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>argc</em>&nbsp;</td><td>The number of arguments to parse </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>argv</em>&nbsp;</td><td>The array of arguments to parse </td></tr>
  </table>
</dl>
<dl compact><dt><b>Remarks:</b></dt><dd>Arguments 2 and 3 are most commonly argc and argv from main(argc, argv) The errfn is initialized to fprintf(stderr... but may be overridden. </dd></dl>

</div>
</div><p>
<a class="anchor" name="g3f58acc4bf065e91300ca6d92e588a39"></a><!-- doxytag: member="apr_getopt.h::apr_getopt_long" ref="g3f58acc4bf065e91300ca6d92e588a39" args="(apr_getopt_t *os, const apr_getopt_option_t *opts, int *option_ch, const char **option_arg)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a> apr_getopt_long           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structapr__getopt__t.html">apr_getopt_t</a> *&nbsp;</td>
          <td class="paramname"> <em>os</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structapr__getopt__option__t.html">apr_getopt_option_t</a> *&nbsp;</td>
          <td class="paramname"> <em>opts</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>option_ch</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char **&nbsp;</td>
          <td class="paramname"> <em>option_arg</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Parse the options initialized by <a class="el" href="group__apr__getopt.html#gca3f4f3be0eb2e847c02e3af6c529e8c">apr_getopt_init()</a>, accepting long options beginning with "--" in addition to single-character options beginning with "-". <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>os</em>&nbsp;</td><td>The <a class="el" href="structapr__getopt__t.html">apr_getopt_t</a> structure created by <a class="el" href="group__apr__getopt.html#gca3f4f3be0eb2e847c02e3af6c529e8c">apr_getopt_init()</a> </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>opts</em>&nbsp;</td><td>A pointer to a list of <a class="el" href="structapr__getopt__option__t.html">apr_getopt_option_t</a> structures, which can be initialized with { "name", optch, has_args }. has_args is nonzero if the option requires an argument. A structure with an optch value of 0 terminates the list. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>option_ch</em>&nbsp;</td><td>Receives the value of "optch" from the <a class="el" href="structapr__getopt__option__t.html">apr_getopt_option_t</a> structure corresponding to the next option matched. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>option_arg</em>&nbsp;</td><td>Receives the argument following the option, if any. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>There are four potential status values on exit. They are: <pre>
             APR_EOF      --  No more options to parse
             APR_BADCH    --  Found a bad option character
             APR_BADARG   --  No argument followed the option flag
             APR_SUCCESS  --  The next option was found.
 </pre> When APR_SUCCESS is returned, os-&gt;ind gives the index of the first non-option argument. On error, a message will be printed to stdout unless os-&gt;err is set to 0. If os-&gt;interleave is set to nonzero, options can come after arguments, and os-&gt;argv will be permuted to leave non-option arguments at the end (the original argv is unaffected). </dd></dl>

</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Tue May 31 12:20:26 2011 for Apache Portable Runtime by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>