util.c revision 1fbf6ba0f5207e6637b49f9a9dfcc779bbe952a9
0797faae937515a5225a36db4a1ec79480d2555cjorton/* ====================================================================
0797faae937515a5225a36db4a1ec79480d2555cjorton * The Apache Software License, Version 1.1
0797faae937515a5225a36db4a1ec79480d2555cjorton * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
0797faae937515a5225a36db4a1ec79480d2555cjorton * reserved.
0797faae937515a5225a36db4a1ec79480d2555cjorton * Redistribution and use in source and binary forms, with or without
0797faae937515a5225a36db4a1ec79480d2555cjorton * modification, are permitted provided that the following conditions
0797faae937515a5225a36db4a1ec79480d2555cjorton * 1. Redistributions of source code must retain the above copyright
0797faae937515a5225a36db4a1ec79480d2555cjorton * notice, this list of conditions and the following disclaimer.
0797faae937515a5225a36db4a1ec79480d2555cjorton * 2. Redistributions in binary form must reproduce the above copyright
0797faae937515a5225a36db4a1ec79480d2555cjorton * notice, this list of conditions and the following disclaimer in
0797faae937515a5225a36db4a1ec79480d2555cjorton * the documentation and/or other materials provided with the
0797faae937515a5225a36db4a1ec79480d2555cjorton * distribution.
0797faae937515a5225a36db4a1ec79480d2555cjorton * 3. The end-user documentation included with the redistribution,
0797faae937515a5225a36db4a1ec79480d2555cjorton * if any, must include the following acknowledgment:
0797faae937515a5225a36db4a1ec79480d2555cjorton * "This product includes software developed by the
0797faae937515a5225a36db4a1ec79480d2555cjorton * Apache Software Foundation (http://www.apache.org/)."
0797faae937515a5225a36db4a1ec79480d2555cjorton * Alternately, this acknowledgment may appear in the software itself,
0797faae937515a5225a36db4a1ec79480d2555cjorton * if and wherever such third-party acknowledgments normally appear.
0797faae937515a5225a36db4a1ec79480d2555cjorton * 4. The names "Apache" and "Apache Software Foundation" must
0797faae937515a5225a36db4a1ec79480d2555cjorton * not be used to endorse or promote products derived from this
0797faae937515a5225a36db4a1ec79480d2555cjorton * software without prior written permission. For written
0797faae937515a5225a36db4a1ec79480d2555cjorton * permission, please contact apache@apache.org.
0797faae937515a5225a36db4a1ec79480d2555cjorton * 5. Products derived from this software may not be called "Apache",
0797faae937515a5225a36db4a1ec79480d2555cjorton * nor may "Apache" appear in their name, without prior written
0797faae937515a5225a36db4a1ec79480d2555cjorton * permission of the Apache Software Foundation.
0797faae937515a5225a36db4a1ec79480d2555cjorton * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
0797faae937515a5225a36db4a1ec79480d2555cjorton * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
dca6643570b2f028bc7af76329bd7e333bf7493cpquerna * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
dca6643570b2f028bc7af76329bd7e333bf7493cpquerna * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
dca6643570b2f028bc7af76329bd7e333bf7493cpquerna * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
dca6643570b2f028bc7af76329bd7e333bf7493cpquerna * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0797faae937515a5225a36db4a1ec79480d2555cjorton * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
0797faae937515a5225a36db4a1ec79480d2555cjorton * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2685f3814b77577ef7b2523442dab1ca88df1e41jorton * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
0797faae937515a5225a36db4a1ec79480d2555cjorton * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
0797faae937515a5225a36db4a1ec79480d2555cjorton * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0797faae937515a5225a36db4a1ec79480d2555cjorton * SUCH DAMAGE.
a10d8ce69c26142323c66adaba109be1b4baa379wrowe * ====================================================================
0797faae937515a5225a36db4a1ec79480d2555cjorton * This software consists of voluntary contributions made by many
0797faae937515a5225a36db4a1ec79480d2555cjorton * individuals on behalf of the Apache Software Foundation. For more
0797faae937515a5225a36db4a1ec79480d2555cjorton * information on the Apache Software Foundation, please see
eab15974b1d8bbcb6d4f9ec75527b39ffded82aajorton * Portions of this software are based upon public domain software
0797faae937515a5225a36db4a1ec79480d2555cjorton * originally written at the National Center for Supercomputing Applications,
8c4aed3f92674325e17d8360ee2797beda3a1472jorton * University of Illinois, Urbana-Champaign.
0797faae937515a5225a36db4a1ec79480d2555cjorton * util.c: string utility things
eab15974b1d8bbcb6d4f9ec75527b39ffded82aajorton * 3/21/93 Rob McCool
0797faae937515a5225a36db4a1ec79480d2555cjorton * 1995-96 Many changes by the Apache Software Foundation
eab15974b1d8bbcb6d4f9ec75527b39ffded82aajorton/* Debugging aid:
eab15974b1d8bbcb6d4f9ec75527b39ffded82aajorton * #define DEBUG to trace all cfg_open*()/cfg_closefile() calls
0797faae937515a5225a36db4a1ec79480d2555cjorton * #define DEBUG_CFG_LINES to trace every line read from the config files
0797faae937515a5225a36db4a1ec79480d2555cjorton/* A bunch of functions in util.c scan strings looking for certain characters.
0797faae937515a5225a36db4a1ec79480d2555cjorton * To make that more efficient we encode a lookup table. The test_char_table
0797faae937515a5225a36db4a1ec79480d2555cjorton * is generated automatically by gen_test_char.c.
8c4aed3f92674325e17d8360ee2797beda3a1472jorton/* we assume the folks using this ensure 0 <= c < 256... which means
8c4aed3f92674325e17d8360ee2797beda3a1472jorton * you need a cast to (unsigned char) first, you can't just plug a
8c4aed3f92674325e17d8360ee2797beda3a1472jorton * char in here and get it to work, because if char is signed then it
8c4aed3f92674325e17d8360ee2797beda3a1472jorton * will first be sign extended.
8c4aed3f92674325e17d8360ee2797beda3a1472jorton#define TEST_CHAR(c, f) (test_char_table[(unsigned)(c)] & (f))
8c4aed3f92674325e17d8360ee2797beda3a1472jorton/* Win32/NetWare/OS2 need to check for both forward and back slashes
0797faae937515a5225a36db4a1ec79480d2555cjorton * in ap_getparents() and ap_escape_url.
0797faae937515a5225a36db4a1ec79480d2555cjorton * Examine a field value (such as a media-/content-type) string and return
0797faae937515a5225a36db4a1ec79480d2555cjorton * it sans any parameters; e.g., strip off any ';charset=foo' and the like.
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_DECLARE(char *) ap_field_noparam(apr_pool_t *p, const char *intype)
a10d8ce69c26142323c66adaba109be1b4baa379wrowe const char *semi;
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_DECLARE(char *) ap_ht_time(apr_pool_t *p, apr_time_t t, const char *fmt,
0797faae937515a5225a36db4a1ec79480d2555cjorton const char *f;
0797faae937515a5225a36db4a1ec79480d2555cjorton /* Convert %Z to "GMT" and %z to "+0000";
0797faae937515a5225a36db4a1ec79480d2555cjorton * on hosts that do not have a time zone string in struct tm,
4b0e00b3346b3e8fd53219d060f4cf6676847a06jim * strftime must assume its argument is local time.
0797faae937515a5225a36db4a1ec79480d2555cjorton for(strp = tf, f = fmt; strp < tf + sizeof(tf) - 6 && (*strp = *f)
eab15974b1d8bbcb6d4f9ec75527b39ffded82aajorton ; f++, strp++) {
eab15974b1d8bbcb6d4f9ec75527b39ffded82aajorton if (*f != '%') continue;
0797faae937515a5225a36db4a1ec79480d2555cjorton switch (f[1]) {
0797faae937515a5225a36db4a1ec79480d2555cjorton /* check return code? */
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_strftime(ts, &retcode, MAX_STRING_LEN, fmt, &xt);
0797faae937515a5225a36db4a1ec79480d2555cjorton/* Roy owes Rob beer. */
0797faae937515a5225a36db4a1ec79480d2555cjorton/* Rob owes Roy dinner. */
0797faae937515a5225a36db4a1ec79480d2555cjorton/* These legacy comments would make a lot more sense if Roy hadn't
0797faae937515a5225a36db4a1ec79480d2555cjorton * replaced the old later_than() routine with util_date.c.
0797faae937515a5225a36db4a1ec79480d2555cjorton * Well, okay, they still wouldn't make any sense.
a10d8ce69c26142323c66adaba109be1b4baa379wrowe/* Match = 0, NoMatch = 1, Abort = -1
3a59bb90be3bc6246632384c3d885b875ae507d5sf * Based loosely on sections of wildmat.c by Rich Salz
a10d8ce69c26142323c66adaba109be1b4baa379wrowe * Hmmm... shouldn't this really go component by component?
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_DECLARE(int) ap_strcmp_match(const char *str, const char *expected)
0797faae937515a5225a36db4a1ec79480d2555cjorton for (x = 0, y = 0; expected[y]; ++y, ++x) {
0797faae937515a5225a36db4a1ec79480d2555cjorton while (str[x]) {
0797faae937515a5225a36db4a1ec79480d2555cjorton if ((ret = ap_strcmp_match(&str[x++], &expected[y])) != 1)
0797faae937515a5225a36db4a1ec79480d2555cjorton else if ((expected[y] != '?') && (str[x] != expected[y]))
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_DECLARE(int) ap_strcasecmp_match(const char *str, const char *expected)
0797faae937515a5225a36db4a1ec79480d2555cjorton for (x = 0, y = 0; expected[y]; ++y, ++x) {
072f7e449a76d28b580de6e89a1723713ab9adb1jorton while (str[x]) {
0797faae937515a5225a36db4a1ec79480d2555cjorton if ((ret = ap_strcasecmp_match(&str[x++], &expected[y])) != 1)
0797faae937515a5225a36db4a1ec79480d2555cjorton/* We actually compare the canonical root to this root, (but we don't
0797faae937515a5225a36db4a1ec79480d2555cjorton * waste time checking the case), since every use of this function in
0797faae937515a5225a36db4a1ec79480d2555cjorton * httpd-2.1 tests if the path is 'proper', meaning we've already passed
0797faae937515a5225a36db4a1ec79480d2555cjorton * it through apr_filepath_merge, or we haven't.
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_DECLARE(int) ap_os_is_path_absolute(apr_pool_t *p, const char *dir)
0797faae937515a5225a36db4a1ec79480d2555cjorton const char *newpath;
eab15974b1d8bbcb6d4f9ec75527b39ffded82aajorton if (apr_filepath_root(&newpath, &dir, 0, p) != APR_SUCCESS
0797faae937515a5225a36db4a1ec79480d2555cjorton register int x;
0797faae937515a5225a36db4a1ec79480d2555cjorton for (x = 0; str[x]; x++)
a10d8ce69c26142323c66adaba109be1b4baa379wrowe * Here's a pool-based interface to POSIX regex's regcomp().
0797faae937515a5225a36db4a1ec79480d2555cjorton * Note that we return regex_t instead of being passed one.
0797faae937515a5225a36db4a1ec79480d2555cjorton * The reason is that if you use an already-used regex_t structure,
0797faae937515a5225a36db4a1ec79480d2555cjorton * the memory that you've already allocated gets forgotten, and
0797faae937515a5225a36db4a1ec79480d2555cjorton * regfree() doesn't clear it. So we don't allow it.
a10d8ce69c26142323c66adaba109be1b4baa379wroweAP_DECLARE(regex_t *) ap_pregcomp(apr_pool_t *p, const char *pattern,
501e60e433e1914c64f642114fbb4fb9be9e2ca9jorton apr_pool_cleanup_register(p, (void *) preg, regex_cleanup,
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_DECLARE(void) ap_pregfree(apr_pool_t *p, regex_t * reg)
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_pool_cleanup_kill(p, (void *) reg, regex_cleanup);
0797faae937515a5225a36db4a1ec79480d2555cjorton * Similar to standard strstr() but we ignore case in this version.
0797faae937515a5225a36db4a1ec79480d2555cjorton * Based on the strstr() implementation further below.
eab15974b1d8bbcb6d4f9ec75527b39ffded82aajortonAP_DECLARE(char *) ap_strcasestr(const char *s1, const char *s2)
0797faae937515a5225a36db4a1ec79480d2555cjorton /* an empty s2 */
501e60e433e1914c64f642114fbb4fb9be9e2ca9jorton return((char *)s1);
0797faae937515a5225a36db4a1ec79480d2555cjorton for ( ; (*s1 != '\0') && (apr_tolower(*s1) != apr_tolower(*s2)); s1++);
0797faae937515a5225a36db4a1ec79480d2555cjorton /* found first character of s2, see if the rest matches */
0797faae937515a5225a36db4a1ec79480d2555cjorton for (++p1, ++p2; apr_tolower(*p1) == apr_tolower(*p2); ++p1, ++p2) {
0797faae937515a5225a36db4a1ec79480d2555cjorton /* both strings ended together */
a10d8ce69c26142323c66adaba109be1b4baa379wrowe return((char *)s1);
0797faae937515a5225a36db4a1ec79480d2555cjorton /* second string ended, a match */
a10d8ce69c26142323c66adaba109be1b4baa379wrowe /* didn't find a match here, try starting at next character in s1 */
0797faae937515a5225a36db4a1ec79480d2555cjorton return((char *)s1);
3e7ce568813f1895b2e8e68e2223653884497bdawrowe * Returns an offsetted pointer in bigstring immediately after
0797faae937515a5225a36db4a1ec79480d2555cjorton * prefix. Returns bigstring if bigstring doesn't start with
a10d8ce69c26142323c66adaba109be1b4baa379wrowe * prefix or if prefix is longer than bigstring while still matching.
0797faae937515a5225a36db4a1ec79480d2555cjorton * NOTE: pointer returned is relative to bigstring, so we
0797faae937515a5225a36db4a1ec79480d2555cjorton * can use standard pointer comparisons in the calling function
0797faae937515a5225a36db4a1ec79480d2555cjorton * (eg: test if ap_stripprefix(a,b) == a)
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_DECLARE(const char *) ap_stripprefix(const char *bigstring,
0797faae937515a5225a36db4a1ec79480d2555cjorton const char *prefix)
0797faae937515a5225a36db4a1ec79480d2555cjorton const char *p1;
0797faae937515a5225a36db4a1ec79480d2555cjorton /* hit the end of bigstring! */
0797faae937515a5225a36db4a1ec79480d2555cjorton * Apache stub function for the regex libraries regexec() to make sure the
0797faae937515a5225a36db4a1ec79480d2555cjorton * whole regex(3) API is available through the Apache (exported) namespace.
0797faae937515a5225a36db4a1ec79480d2555cjorton * This is especially important for the DSO situations of modules.
0797faae937515a5225a36db4a1ec79480d2555cjorton * DO NOT MAKE A MACRO OUT OF THIS FUNCTION!
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_DECLARE(int) ap_regexec(regex_t *preg, const char *string,
0797faae937515a5225a36db4a1ec79480d2555cjorton return regexec(preg, string, nmatch, pmatch, eflags);
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_DECLARE(size_t) ap_regerror(int errcode, const regex_t *preg, char *errbuf,
0797faae937515a5225a36db4a1ec79480d2555cjorton/* This function substitutes for $0-$9, filling in regular expression
a10d8ce69c26142323c66adaba109be1b4baa379wrowe * submatches. Pass it the same nmatch and pmatch arguments that you
a10d8ce69c26142323c66adaba109be1b4baa379wrowe * passed ap_regexec(). pmatch should not be greater than the maximum number
a10d8ce69c26142323c66adaba109be1b4baa379wrowe * of subexpressions - i.e. one more than the re_nsub member of regex_t.
a10d8ce69c26142323c66adaba109be1b4baa379wrowe * input should be the string with the $-expressions, source should be the
0797faae937515a5225a36db4a1ec79480d2555cjorton * string that was matched against.
0797faae937515a5225a36db4a1ec79480d2555cjorton * It returns the substituted string, or NULL on error.
0797faae937515a5225a36db4a1ec79480d2555cjorton * Parts of this code are based on Henry Spencer's regsub(), from his
0797faae937515a5225a36db4a1ec79480d2555cjorton * AT&T V8 regexp package.
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input,
0797faae937515a5225a36db4a1ec79480d2555cjorton /* First pass, find the size */
0797faae937515a5225a36db4a1ec79480d2555cjorton if (c == '&')
0797faae937515a5225a36db4a1ec79480d2555cjorton else if (no < nmatch && pmatch[no].rm_so < pmatch[no].rm_eo) {
a10d8ce69c26142323c66adaba109be1b4baa379wrowe /* Now actually fill in the string */
0797faae937515a5225a36db4a1ec79480d2555cjorton if (c == '&')
0797faae937515a5225a36db4a1ec79480d2555cjorton else if (no < nmatch && pmatch[no].rm_so < pmatch[no].rm_eo) {
0797faae937515a5225a36db4a1ec79480d2555cjorton * Parse .. so we don't compromise security
a10d8ce69c26142323c66adaba109be1b4baa379wrowe /* Four paseses, as per RFC 1808 */
250fbbb51225da0dfc973743b795b04dc9740027wrowe /* a) remove ./ path segments */
250fbbb51225da0dfc973743b795b04dc9740027wrowe /* b) remove trailing . path, segment */
250fbbb51225da0dfc973743b795b04dc9740027wrowe else if (w > 1 && name[w - 1] == '.' && IS_SLASH(name[w - 2]))
250fbbb51225da0dfc973743b795b04dc9740027wrowe /* c) remove all xx/../ segments. (including leading ../ and /../) */
250fbbb51225da0dfc973743b795b04dc9740027wrowe if (name[l] == '.' && name[l + 1] == '.' && IS_SLASH(name[l + 2])
250fbbb51225da0dfc973743b795b04dc9740027wrowe register int m = l + 3, n;
250fbbb51225da0dfc973743b795b04dc9740027wrowe if (l >= 0) {
250fbbb51225da0dfc973743b795b04dc9740027wrowe (++n, ++m);
250fbbb51225da0dfc973743b795b04dc9740027wrowe /* d) remove trailing xx/.. segment. */
250fbbb51225da0dfc973743b795b04dc9740027wrowe else if (l > 2 && name[l - 1] == '.' && name[l - 2] == '.'
250fbbb51225da0dfc973743b795b04dc9740027wrowe if (l >= 0) {
a10d8ce69c26142323c66adaba109be1b4baa379wrowe char *d, *s;
0797faae937515a5225a36db4a1ec79480d2555cjorton /* Check for UNC names. Leave leading two slashes. */
0797faae937515a5225a36db4a1ec79480d2555cjorton *d++ = *s++;
36ef8f77bffe75d1aa327882be1b5bdbe2ff567asf while (*s) {
0797faae937515a5225a36db4a1ec79480d2555cjorton if ((*d++ = *s) == '/') {
0797faae937515a5225a36db4a1ec79480d2555cjorton } while (*s == '/');
* and s == "e:/test.html", "e:/" is returned in d
* *** See also directory_walk in modules/http/http_request.c
memcpy(d, s, l);
for (x = 0, n = 0; path[x]; x++)
int len;
char *res;
++pos;
if (stop) {
++pos;
return res;
int len;
char *res;
++pos;
++pos;
return res;
char stop)
char stop)
char *res;
if (!pos) {
return res;
++pos;
return res;
char quote)
for (i = 0; i < len; ++i) {
return result;
char *res;
char quote;
++str;
if (!*str) {
++strend;
++strend;
++strend;
++strend;
return res;
return word;
const char *e2 = e;
char *var;
#ifdef DEBUG
char ch;
return ch;
return (int)EOF;
return buf;
return NULL;
#ifdef DEBUG
return APR_EBADF;
APR_OS_DEFAULT, p);
#ifdef DEBUG
return status;
return status;
name);
return APR_EBADF;
#ifdef WIN32
return APR_SUCCESS;
const char *descr,
void *param,
#ifdef DEBUG
return new_cfg;
return ch;
char *cp;
cp++;
cp--;
cp--;
cp--;
++src;
#ifdef DEBUG_CFG_LINES
register size_t i = 0;
if (c == EOF)
if (c == CR) {
if (c == LF) {
#ifdef DEBUG_CFG_LINES
buf[i] = c;
const unsigned char *token;
++ptr;
++ptr) {
if (in_qpair) {
in_qpair = 0;
switch (*ptr) {
++in_com;
--in_com;
return NULL;
++ptr;
return (const char *)token;
const char *tok_start;
const unsigned char *ptr;
unsigned char *pos;
char *token;
return NULL;
++ptr) {
if (in_qpair) {
in_qpair = 0;
switch (*ptr) {
addspace = 0;
addspace = 0;
++in_com;
addspace = 0;
--in_com;
addspace = 0;
addspace = 0;
return token;
const char *tok)
const unsigned char *pos;
++ptr;
if (*ptr)
++ptr) {
if (in_qpair) {
in_qpair = 0;
if (good)
switch (*ptr) {
addspace = 0;
addspace = 0;
++in_com;
addspace = 0;
--in_com;
addspace = 0;
default : if (!good)
addspace = 0;
return good;
int accept_white)
const char *tok_start;
char *token;
int tok_len;
++ptr;
while (*ptr)
++ptr;
return token;
const unsigned char *start_token;
if (!line)
s = (const unsigned char *)line;
start_token = s;
s - start_token)) {
const char *tok)
if (!line)
if (lidx < 0 ||
char *cmd;
d = (unsigned char *)cmd;
s = (const unsigned char *)str;
return cmd;
register char digit;
#if !APR_CHARSET_EBCDIC
return (digit);
badesc = 0;
badpath = 0;
if (y == NULL) {
return OK;
if (badesc)
return HTTP_BAD_REQUEST;
else if (badpath)
return HTTP_NOT_FOUND;
return OK;
badesc = 0;
badpath = 0;
if (y == NULL) {
return OK;
char decoded;
*x = decoded;
if (badesc) {
return HTTP_BAD_REQUEST;
else if (badpath) {
return HTTP_NOT_FOUND;
return OK;
return where;
const unsigned char *s = (const unsigned char *)segment;
unsigned char *d = (unsigned char *)copy;
d = c2x(c, d);
return copy;
const unsigned char *s = (const unsigned char *)path;
unsigned char *d = (unsigned char *)copy;
if (!partial) {
d = c2x(c, d);
return copy;
return apr_pstrmemdup(p, s, i);
char *ret;
if (!str) {
return NULL;
d = (unsigned char *)ret;
s = (const unsigned char *)str;
c2x(*s, d);
return ret;
const char *src2)
char *path;
if (len1 == 0) {
char *next;
return path;
const char *p = ap_strchr_c(s, c);
if (p == NULL)
const char *p = ap_strrchr_c(s, c);
if (p == NULL)
while (*str) {
++str;
if (p->h_aliases) {
for (x = 0; p->h_aliases[x]; ++x) {
return NULL;
#ifndef MAXHOSTNAMELEN
struct hostent *p;
#ifdef BEOS_R5
if (p && p->h_addr_list[0]) {
return server_hostname;
if (!server_hostname)
return server_hostname;
/* simple 'pool' alloc()ing glue to apr_base64.c
char *decoded;
return decoded;
char *encoded;
return encoded;
char *semi;
if (semi) {
while (*str) {
++str;
if (semi) {
int newlen = 0;
newlen++;
newlen++;
inchr++;
newlen++;
inchr++;
return outstring;