<!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: apr_lib.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.3.9.1 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div> <div class="nav"> <a class="el" href="dir_000000.html">home</a> / <a class="el" href="dir_000001.html">oden</a> / <a class="el" href="dir_000002.html">RPM</a> / <a class="el" href="dir_000003.html">BUILD</a> / <a class="el" href="dir_000004.html">apr-1.1.1</a> / <a class="el" href="dir_000005.html">include</a></div> <h1>apr_lib.h</h1><a href="apr__lib_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/* Copyright 2000-2004 The Apache Software Foundation</span> 00002 <span class="comment"> *</span> 00003 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span> 00004 <span class="comment"> * you may not use this file except in compliance with the License.</span> 00005 <span class="comment"> * You may obtain a copy of the License at</span> 00006 <span class="comment"> *</span> 00007 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span> 00008 <span class="comment"> *</span> 00009 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span> 00010 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span> 00011 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span> 00012 <span class="comment"> * See the License for the specific language governing permissions and</span> 00013 <span class="comment"> * limitations under the License.</span> 00014 <span class="comment"> */</span> 00015 00016 <span class="preprocessor">#ifndef APR_LIB_H</span> 00017 <span class="preprocessor"></span><span class="preprocessor">#define APR_LIB_H</span> 00018 <span class="preprocessor"></span><span class="comment"></span> 00019 <span class="comment">/**</span> 00020 <span class="comment"> * @file apr_lib.h</span> 00021 <span class="comment"> * This is collection of oddballs that didn't fit anywhere else,</span> 00022 <span class="comment"> * and might move to more appropriate headers with the release</span> 00023 <span class="comment"> * of APR 1.0.</span> 00024 <span class="comment"> * @brief APR general purpose library routines</span> 00025 <span class="comment"> */</span> 00026 00027 <span class="preprocessor">#include "<a class="code" href="apr_8h.html">apr.h</a>"</span> 00028 <span class="preprocessor">#include "<a class="code" href="apr__errno_8h.html">apr_errno.h</a>"</span> 00029 00030 <span class="preprocessor">#if APR_HAVE_CTYPE_H</span> 00031 <span class="preprocessor"></span><span class="preprocessor">#include <ctype.h></span> 00032 <span class="preprocessor">#endif</span> 00033 <span class="preprocessor"></span><span class="preprocessor">#if APR_HAVE_STDARG_H</span> 00034 <span class="preprocessor"></span><span class="preprocessor">#include <stdarg.h></span> 00035 <span class="preprocessor">#endif</span> 00036 <span class="preprocessor"></span> 00037 <span class="preprocessor">#ifdef __cplusplus</span> 00038 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> { 00039 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span> 00040 <span class="comment"></span> 00041 <span class="comment">/**</span> 00042 <span class="comment"> * @defgroup apr_lib General Purpose Library Routines</span> 00043 <span class="comment"> * @ingroup APR </span> 00044 <span class="comment"> * This is collection of oddballs that didn't fit anywhere else,</span> 00045 <span class="comment"> * and might move to more appropriate headers with the release</span> 00046 <span class="comment"> * of APR 1.0.</span> 00047 <span class="comment"> * @{</span> 00048 <span class="comment"> */</span> 00049 <span class="comment"></span> 00050 <span class="comment">/** A constant representing a 'large' string. */</span> <a name="l00051"></a><a class="code" href="group__apr__lib.html#ga4">00051</a> <span class="preprocessor">#define HUGE_STRING_LEN 8192</span> 00052 <span class="preprocessor"></span> 00053 <span class="comment">/*</span> 00054 <span class="comment"> * Define the structures used by the APR general-purpose library.</span> 00055 <span class="comment"> */</span> 00056 <span class="comment"></span> 00057 <span class="comment">/** @see apr_vformatter_buff_t */</span> <a name="l00058"></a><a class="code" href="group__apr__lib.html#ga0">00058</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__vformatter__buff__t.html">apr_vformatter_buff_t</a> <a class="code" href="group__apr__lib.html#ga0">apr_vformatter_buff_t</a>; 00059 <span class="comment"></span> 00060 <span class="comment">/**</span> 00061 <span class="comment"> * Structure used by the variable-formatter routines.</span> 00062 <span class="comment"> */</span> <a name="l00063"></a><a class="code" href="structapr__vformatter__buff__t.html">00063</a> <span class="keyword">struct </span><a class="code" href="group__apr__lib.html#ga0">apr_vformatter_buff_t</a> {<span class="comment"></span> 00064 <span class="comment"> /** The current position */</span> <a name="l00065"></a><a class="code" href="structapr__vformatter__buff__t.html#o0">00065</a> <span class="keywordtype">char</span> *curpos;<span class="comment"></span> 00066 <span class="comment"> /** The end position of the format string */</span> <a name="l00067"></a><a class="code" href="structapr__vformatter__buff__t.html#o1">00067</a> <span class="keywordtype">char</span> *endpos; 00068 }; 00069 <span class="comment"></span> 00070 <span class="comment">/**</span> 00071 <span class="comment"> * return the final element of the pathname</span> 00072 <span class="comment"> * @param pathname The path to get the final element of</span> 00073 <span class="comment"> * @return the final element of the path</span> 00074 <span class="comment"> * @remark</span> 00075 <span class="comment"> * <PRE></span> 00076 <span class="comment"> * For example:</span> 00077 <span class="comment"> * "/foo/bar/gum" -> "gum"</span> 00078 <span class="comment"> * "/foo/bar/gum/" -> ""</span> 00079 <span class="comment"> * "gum" -> "gum"</span> 00080 <span class="comment"> * "bs\\path\\stuff" -> "stuff"</span> 00081 <span class="comment"> * </PRE></span> 00082 <span class="comment"> */</span> 00083 <a class="code" href="group__apr__platform.html#ga123">APR_DECLARE</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *) apr_filepath_name_get(const <span class="keywordtype">char</span> *pathname); 00084 <span class="comment"></span> 00085 <span class="comment">/**</span> 00086 <span class="comment"> * apr_killpg</span> 00087 <span class="comment"> * Small utility macros to make things easier to read. Not usually a</span> 00088 <span class="comment"> * goal, to be sure..</span> 00089 <span class="comment"> */</span> 00090 00091 #ifdef WIN32 00092 #define apr_killpg(x, y) 00093 #else <span class="comment">/* WIN32 */</span> 00094 #ifdef NO_KILLPG 00095 #define apr_killpg(x, y) (kill (-(x), (y))) 00096 #else <span class="comment">/* NO_KILLPG */</span> <a name="l00097"></a><a class="code" href="group__apr__lib.html#ga5">00097</a> #define apr_killpg(x, y) (killpg ((x), (y))) 00098 #endif <span class="comment">/* NO_KILLPG */</span> 00099 #endif <span class="comment">/* WIN32 */</span> 00100 <span class="comment"></span> 00101 <span class="comment">/**</span> 00102 <span class="comment"> * apr_vformatter() is a generic printf-style formatting routine</span> 00103 <span class="comment"> * with some extensions.</span> 00104 <span class="comment"> * @param flush_func The function to call when the buffer is full</span> 00105 <span class="comment"> * @param c The buffer to write to</span> 00106 <span class="comment"> * @param fmt The format string</span> 00107 <span class="comment"> * @param ap The arguments to use to fill out the format string.</span> 00108 <span class="comment"> *</span> 00109 <span class="comment"> * @remark</span> 00110 <span class="comment"> * <PRE></span> 00111 <span class="comment"> * The extensions are:</span> 00112 <span class="comment"> *</span> 00113 <span class="comment"> * %%pA takes a struct in_addr *, and prints it as a.b.c.d</span> 00114 <span class="comment"> * %%pI takes an apr_sockaddr_t * and prints it as a.b.c.d:port or</span> 00115 <span class="comment"> * [ipv6-address]:port</span> 00116 <span class="comment"> * %%pT takes an apr_os_thread_t * and prints it in decimal</span> 00117 <span class="comment"> * ('0' is printed if !APR_HAS_THREADS)</span> 00118 <span class="comment"> * %%pp takes a void * and outputs it in hex</span> 00119 <span class="comment"> *</span> 00120 <span class="comment"> * The %%p hacks are to force gcc's printf warning code to skip</span> 00121 <span class="comment"> * over a pointer argument without complaining. This does</span> 00122 <span class="comment"> * mean that the ANSI-style %%p (output a void * in hex format) won't</span> 00123 <span class="comment"> * work as expected at all, but that seems to be a fair trade-off</span> 00124 <span class="comment"> * for the increased robustness of having printf-warnings work.</span> 00125 <span class="comment"> *</span> 00126 <span class="comment"> * Additionally, apr_vformatter allows for arbitrary output methods</span> 00127 <span class="comment"> * using the apr_vformatter_buff and flush_func.</span> 00128 <span class="comment"> *</span> 00129 <span class="comment"> * The apr_vformatter_buff has two elements curpos and endpos.</span> 00130 <span class="comment"> * curpos is where apr_vformatter will write the next byte of output.</span> 00131 <span class="comment"> * It proceeds writing output to curpos, and updating curpos, until</span> 00132 <span class="comment"> * either the end of output is reached, or curpos == endpos (i.e. the</span> 00133 <span class="comment"> * buffer is full).</span> 00134 <span class="comment"> *</span> 00135 <span class="comment"> * If the end of output is reached, apr_vformatter returns the</span> 00136 <span class="comment"> * number of bytes written.</span> 00137 <span class="comment"> *</span> 00138 <span class="comment"> * When the buffer is full, the flush_func is called. The flush_func</span> 00139 <span class="comment"> * can return -1 to indicate that no further output should be attempted,</span> 00140 <span class="comment"> * and apr_vformatter will return immediately with -1. Otherwise</span> 00141 <span class="comment"> * the flush_func should flush the buffer in whatever manner is</span> 00142 <span class="comment"> * appropriate, re apr_pool_t nitialize curpos and endpos, and return 0.</span> 00143 <span class="comment"> *</span> 00144 <span class="comment"> * Note that flush_func is only invoked as a result of attempting to</span> 00145 <span class="comment"> * write another byte at curpos when curpos >= endpos. So for</span> 00146 <span class="comment"> * example, it's possible when the output exactly matches the buffer</span> 00147 <span class="comment"> * space available that curpos == endpos will be true when</span> 00148 <span class="comment"> * apr_vformatter returns.</span> 00149 <span class="comment"> *</span> 00150 <span class="comment"> * apr_vformatter does not call out to any other code, it is entirely</span> 00151 <span class="comment"> * self-contained. This allows the callers to do things which are</span> 00152 <span class="comment"> * otherwise "unsafe". For example, apr_psprintf uses the "scratch"</span> 00153 <span class="comment"> * space at the unallocated end of a block, and doesn't actually</span> 00154 <span class="comment"> * complete the allocation until apr_vformatter returns. apr_psprintf</span> 00155 <span class="comment"> * would be completely broken if apr_vformatter were to call anything</span> 00156 <span class="comment"> * that used this same pool. Similarly http_bprintf() uses the "scratch"</span> 00157 <span class="comment"> * space at the end of its output buffer, and doesn't actually note</span> 00158 <span class="comment"> * that the space is in use until it either has to flush the buffer</span> 00159 <span class="comment"> * or until apr_vformatter returns.</span> 00160 <span class="comment"> * </PRE></span> 00161 <span class="comment"> */</span> 00162 APR_DECLARE(<span class="keywordtype">int</span>) apr_vformatter(<span class="keywordtype">int</span> (*flush_func)(apr_vformatter_buff_t *b), 00163 apr_vformatter_buff_t *c, const <span class="keywordtype">char</span> *fmt, 00164 va_list ap); 00165 <span class="comment"></span> 00166 <span class="comment">/**</span> 00167 <span class="comment"> * Display a prompt and read in the password from stdin.</span> 00168 <span class="comment"> * @param prompt The prompt to display</span> 00169 <span class="comment"> * @param pwbuf Buffer to store the password</span> 00170 <span class="comment"> * @param bufsize The length of the password buffer.</span> 00171 <span class="comment"> * @remark If the password entered must be truncated to fit in</span> 00172 <span class="comment"> * the provided buffer, APR_ENAMETOOLONG will be returned.</span> 00173 <span class="comment"> * Note that the bufsize paramater is passed by reference for no</span> 00174 <span class="comment"> * reason; its value will never be modified by the apr_password_get()</span> 00175 <span class="comment"> * function.</span> 00176 <span class="comment"> */</span> 00177 APR_DECLARE(apr_status_t) apr_password_get(const <span class="keywordtype">char</span> *prompt, <span class="keywordtype">char</span> *pwbuf, 00178 apr_size_t *bufsize); 00179 <span class="comment"></span> 00180 <span class="comment">/** @} */</span> 00181 <span class="comment"></span> 00182 <span class="comment">/**</span> 00183 <span class="comment"> * @defgroup apr_ctype ctype functions</span> 00184 <span class="comment"> * These macros allow correct support of 8-bit characters on systems which</span> 00185 <span class="comment"> * support 8-bit characters. Pretty dumb how the cast is required, but</span> 00186 <span class="comment"> * that's legacy libc for ya. These new macros do not support EOF like</span> 00187 <span class="comment"> * the standard macros do. Tough.</span> 00188 <span class="comment"> * @{</span> 00189 <span class="comment"> */</span><span class="comment"></span> 00190 <span class="comment">/** @see isalnum */</span> <a name="l00191"></a><a class="code" href="group__apr__ctype.html#ga0">00191</a> #define apr_isalnum(c) (isalnum(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c))))<span class="comment"></span> 00192 <span class="comment">/** @see isalpha */</span> <a name="l00193"></a><a class="code" href="group__apr__ctype.html#ga1">00193</a> #define apr_isalpha(c) (isalpha(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c))))<span class="comment"></span> 00194 <span class="comment">/** @see iscntrl */</span> <a name="l00195"></a><a class="code" href="group__apr__ctype.html#ga2">00195</a> #define apr_iscntrl(c) (iscntrl(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c))))<span class="comment"></span> 00196 <span class="comment">/** @see isdigit */</span> <a name="l00197"></a><a class="code" href="group__apr__ctype.html#ga3">00197</a> #define apr_isdigit(c) (isdigit(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c))))<span class="comment"></span> 00198 <span class="comment">/** @see isgraph */</span> <a name="l00199"></a><a class="code" href="group__apr__ctype.html#ga4">00199</a> #define apr_isgraph(c) (isgraph(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c))))<span class="comment"></span> 00200 <span class="comment">/** @see islower*/</span> <a name="l00201"></a><a class="code" href="group__apr__ctype.html#ga5">00201</a> #define apr_islower(c) (islower(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c))))<span class="comment"></span> 00202 <span class="comment">/** @see isascii */</span> 00203 #ifdef isascii 00204 #define apr_isascii(c) (isascii(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c)))) 00205 #else <a name="l00206"></a><a class="code" href="group__apr__ctype.html#ga6">00206</a> #define apr_isascii(c) (((c) & ~0x7f)==0) 00207 #endif<span class="comment"></span> 00208 <span class="comment">/** @see isprint */</span> <a name="l00209"></a><a class="code" href="group__apr__ctype.html#ga7">00209</a> #define apr_isprint(c) (isprint(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c))))<span class="comment"></span> 00210 <span class="comment">/** @see ispunct */</span> <a name="l00211"></a><a class="code" href="group__apr__ctype.html#ga8">00211</a> #define apr_ispunct(c) (ispunct(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c))))<span class="comment"></span> 00212 <span class="comment">/** @see isspace */</span> <a name="l00213"></a><a class="code" href="group__apr__ctype.html#ga9">00213</a> #define apr_isspace(c) (isspace(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c))))<span class="comment"></span> 00214 <span class="comment">/** @see isupper */</span> <a name="l00215"></a><a class="code" href="group__apr__ctype.html#ga10">00215</a> #define apr_isupper(c) (isupper(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c))))<span class="comment"></span> 00216 <span class="comment">/** @see isxdigit */</span> <a name="l00217"></a><a class="code" href="group__apr__ctype.html#ga11">00217</a> #define apr_isxdigit(c) (isxdigit(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c))))<span class="comment"></span> 00218 <span class="comment">/** @see tolower */</span> <a name="l00219"></a><a class="code" href="group__apr__ctype.html#ga12">00219</a> #define apr_tolower(c) (tolower(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c))))<span class="comment"></span> 00220 <span class="comment">/** @see toupper */</span> <a name="l00221"></a><a class="code" href="group__apr__ctype.html#ga13">00221</a> #define apr_toupper(c) (toupper(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)(c)))) 00222 <span class="comment"></span> 00223 <span class="comment">/** @} */</span> 00224 00225 #ifdef __cplusplus 00226 } 00227 #endif 00228 00229 #endif <span class="comment">/* ! APR_LIB_H */</span> </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Mar 20 19:52:26 2005 for Apache Portable Runtime by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address> </body> </html>