⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apr__getopt_8h-source.html

📁 apr函数库使用手册
💻 HTML
📖 第 1 页 / 共 2 页
字号:
00080 <span class="comment"> */</span>
<a name="l00081"></a><a class="code" href="structapr__getopt__option__t.html">00081</a> <span class="keyword">struct </span><a class="code" href="group__apr__getopt.html#ga2">apr_getopt_option_t</a> {<span class="comment"></span>
00082 <span class="comment">    /** long option name, or NULL if option has no long name */</span>
<a name="l00083"></a><a class="code" href="structapr__getopt__option__t.html#o0">00083</a>     <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="structapr__getopt__option__t.html#o0">name</a>;<span class="comment"></span>
00084 <span class="comment">    /** option letter, or a value greater than 255 if option has no letter */</span>
<a name="l00085"></a><a class="code" href="structapr__getopt__option__t.html#o1">00085</a>     <span class="keywordtype">int</span> <a class="code" href="structapr__getopt__option__t.html#o1">optch</a>;<span class="comment"></span>
00086 <span class="comment">    /** nonzero if option takes an argument */</span>
<a name="l00087"></a><a class="code" href="structapr__getopt__option__t.html#o2">00087</a>     <span class="keywordtype">int</span> <a class="code" href="structapr__getopt__option__t.html#o2">has_arg</a>;<span class="comment"></span>
00088 <span class="comment">    /** a description of the option */</span>
<a name="l00089"></a><a class="code" href="structapr__getopt__option__t.html#o3">00089</a>     <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="structapr__getopt__option__t.html#o3">description</a>;
00090 };
00091 <span class="comment"></span>
00092 <span class="comment">/**</span>
00093 <span class="comment"> * Initialize the arguments for parsing by apr_getopt().</span>
00094 <span class="comment"> * @param os   The options structure created for apr_getopt()</span>
00095 <span class="comment"> * @param cont The pool to operate on</span>
00096 <span class="comment"> * @param argc The number of arguments to parse</span>
00097 <span class="comment"> * @param argv The array of arguments to parse</span>
00098 <span class="comment"> * @remark Arguments 2 and 3 are most commonly argc and argv from main(argc, argv)</span>
00099 <span class="comment"> * The errfn is initialized to fprintf(stderr... but may be overridden.</span>
00100 <span class="comment"> */</span>
00101 APR_DECLARE(apr_status_t) apr_getopt_init(apr_getopt_t **os, apr_pool_t *cont,
00102                                       <span class="keywordtype">int</span> argc, const <span class="keywordtype">char</span> * const *argv);
00103 <span class="comment"></span>
00104 <span class="comment">/**</span>
00105 <span class="comment"> * Parse the options initialized by apr_getopt_init().</span>
00106 <span class="comment"> * @param os     The apr_opt_t structure returned by apr_getopt_init()</span>
00107 <span class="comment"> * @param opts   A string of characters that are acceptable options to the </span>
00108 <span class="comment"> *               program.  Characters followed by ":" are required to have an </span>
00109 <span class="comment"> *               option associated</span>
00110 <span class="comment"> * @param option_ch  The next option character parsed</span>
00111 <span class="comment"> * @param option_arg The argument following the option character:</span>
00112 <span class="comment"> * @return There are four potential status values on exit. They are:</span>
00113 <span class="comment"> * &lt;PRE&gt;</span>
00114 <span class="comment"> *             APR_EOF      --  No more options to parse</span>
00115 <span class="comment"> *             APR_BADCH    --  Found a bad option character</span>
00116 <span class="comment"> *             APR_BADARG   --  No argument followed the option flag</span>
00117 <span class="comment"> *             APR_SUCCESS  --  The next option was found.</span>
00118 <span class="comment"> * &lt;/PRE&gt;</span>
00119 <span class="comment"> */</span>
00120 APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const <span class="keywordtype">char</span> *opts, 
00121                                      <span class="keywordtype">char</span> *option_ch, const <span class="keywordtype">char</span> **option_arg);
00122 <span class="comment"></span>
00123 <span class="comment">/**</span>
00124 <span class="comment"> * Parse the options initialized by apr_getopt_init(), accepting long</span>
00125 <span class="comment"> * options beginning with "--" in addition to single-character</span>
00126 <span class="comment"> * options beginning with "-".</span>
00127 <span class="comment"> * @param os     The apr_getopt_t structure created by apr_getopt_init()</span>
00128 <span class="comment"> * @param opts   A pointer to a list of apr_getopt_option_t structures, which</span>
00129 <span class="comment"> *               can be initialized with { "name", optch, has_args }.  has_args</span>
00130 <span class="comment"> *               is nonzero if the option requires an argument.  A structure</span>
00131 <span class="comment"> *               with an optch value of 0 terminates the list.</span>
00132 <span class="comment"> * @param option_ch  Receives the value of "optch" from the apr_getopt_option_t</span>
00133 <span class="comment"> *                   structure corresponding to the next option matched.</span>
00134 <span class="comment"> * @param option_arg Receives the argument following the option, if any.</span>
00135 <span class="comment"> * @return There are four potential status values on exit.   They are:</span>
00136 <span class="comment"> * &lt;PRE&gt;</span>
00137 <span class="comment"> *             APR_EOF      --  No more options to parse</span>
00138 <span class="comment"> *             APR_BADCH    --  Found a bad option character</span>
00139 <span class="comment"> *             APR_BADARG   --  No argument followed the option flag</span>
00140 <span class="comment"> *             APR_SUCCESS  --  The next option was found.</span>
00141 <span class="comment"> * &lt;/PRE&gt;</span>
00142 <span class="comment"> * When APR_SUCCESS is returned, os-&gt;ind gives the index of the first</span>
00143 <span class="comment"> * non-option argument.  On error, a message will be printed to stdout unless</span>
00144 <span class="comment"> * os-&gt;err is set to 0.  If os-&gt;interleave is set to nonzero, options can come</span>
00145 <span class="comment"> * after arguments, and os-&gt;argv will be permuted to leave non-option arguments</span>
00146 <span class="comment"> * at the end (the original argv is unaffected).</span>
00147 <span class="comment"> */</span>
00148 APR_DECLARE(apr_status_t) apr_getopt_long(apr_getopt_t *os,
00149                                           const apr_getopt_option_t *opts,
00150                                           <span class="keywordtype">int</span> *option_ch,
00151                                           const <span class="keywordtype">char</span> **option_arg);<span class="comment"></span>
00152 <span class="comment">/** @} */</span>
00153 
00154 #ifdef __cplusplus
00155 }
00156 #endif
00157 
00158 #endif  <span class="comment">/* ! APR_GETOPT_H */</span>
</div></pre><hr size="1"><address style="align: right;"><small>Generated on Mon Feb 7 13:18:25 2005 for Apache Portable Runtime by
<a href="../../../www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.7 </small></address>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -