You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@locus.apache.org on 2000/07/21 21:50:58 UTC

cvs commit: apache-2.0/src/support htpasswd.c

rbb         00/07/21 12:50:58

  Modified:    src      CHANGES
               src/ap   ap_cache.c ap_sha1.c
               src/lib/apr configure.in
               src/lib/apr/file_io/unix dir.c fileacc.c filedup.c open.c
                        pipe.c
               src/lib/apr/i18n/unix xlate.c
               src/lib/apr/include apr_lib.h apr_pools.h
               src/lib/apr/lib Makefile.in apr_getpass.c apr_md5.c
                        apr_pools.c apr_tables.c
               src/lib/apr/locks/unix crossproc.c locks.c
               src/lib/apr/misc/unix errorcodes.c start.c
               src/lib/apr/network_io/unix sockaddr.c sockopt.c
               src/lib/apr/threadproc/unix proc.c
               src/main http_config.c http_connection.c http_core.c
                        http_log.c http_main.c http_protocol.c
                        http_request.c http_vhost.c listen.c util.c
                        util_md5.c util_script.c util_uri.c util_xml.c
               src/modules/mpm/beos beos.c
               src/modules/mpm/dexter dexter.c
               src/modules/mpm/mpmt mpmt.c
               src/modules/mpm/mpmt_beos mpmt_beos.c
               src/modules/mpm/mpmt_pthread mpmt_pthread.c
               src/modules/mpm/prefork prefork.c
               src/modules/standard mod_access.c mod_actions.c mod_alias.c
                        mod_asis.c mod_auth.c mod_autoindex.c mod_cgi.c
                        mod_cgid.c mod_dir.c mod_env.c mod_imap.c
                        mod_include.c mod_log_config.c mod_mime.c
                        mod_negotiation.c mod_setenvif.c mod_userdir.c
               src/support htpasswd.c
  Added:       src/lib/apr/include apr_strings.h
               src/lib/apr/strings .cvsignore Makefile.in apr_cpystrn.c
                        apr_snprintf.c apr_strings.c apr_strnatcmp.c
  Removed:     src/lib/apr/lib apr_cpystrn.c apr_snprintf.c apr_strnatcmp.c
  Log:
  Move all APR functions related to strings to their own directory, and
  create a new header for those functions.  This is the first step to
  removing the apr/lib directory completely, and moving those files/functions
  to descriptive directories.
  
  Revision  Changes    Path
  1.177     +2 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.176
  retrieving revision 1.177
  diff -u -r1.176 -r1.177
  --- CHANGES	2000/07/19 17:42:55	1.176
  +++ CHANGES	2000/07/21 19:50:37	1.177
  @@ -1,4 +1,6 @@
   Changes with Apache 2.0a5
  +  *) Move all strings functions in APR to src/lib/apr/strings and create
  +     apr_strings.h for the prototypes. [Ryan Bloom]
   
     *) APR lock fixes: when using SysV sems, flock(), or fcntl(), be sure
        to repeat the syscall until we stop getting EINTR.  I noticed a
  
  
  
  1.6       +1 -0      apache-2.0/src/ap/ap_cache.c
  
  Index: ap_cache.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_cache.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ap_cache.c	2000/06/28 14:01:00	1.5
  +++ ap_cache.c	2000/07/21 19:50:38	1.6
  @@ -1,3 +1,4 @@
  +#include "apr_strings.h"
   #include "ap_cache.h"
   #include "httpd.h"
   #include "http_log.h"
  
  
  
  1.12      +1 -0      apache-2.0/src/ap/ap_sha1.c
  
  Index: ap_sha1.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_sha1.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ap_sha1.c	2000/05/27 22:28:00	1.11
  +++ ap_sha1.c	2000/07/21 19:50:38	1.12
  @@ -85,6 +85,7 @@
   #include "ap_config.h"
   #include "ap_sha1.h"
   #include "ap_base64.h"
  +#include "apr_strings.h"
   #include "apr_lib.h"
   #ifdef CHARSET_EBCDIC
   #include "apr_xlate.h"
  
  
  
  1.137     +2 -2      apache-2.0/src/lib/apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/configure.in,v
  retrieving revision 1.136
  retrieving revision 1.137
  diff -u -r1.136 -r1.137
  --- configure.in	2000/07/15 15:39:05	1.136
  +++ configure.in	2000/07/21 19:50:38	1.137
  @@ -682,8 +682,8 @@
   AC_SUBST(EXEEXT)
   
   echo "Construct Makefiles and header files."
  -MAKEFILE1="Makefile lib/Makefile "
  -SUBDIRS="lib "
  +MAKEFILE1="Makefile lib/Makefile strings/Makefile"
  +SUBDIRS="lib strings "
   for dir in $MODULES
   do
       test -d $dir || $MKDIR -p $dir
  
  
  
  1.35      +1 -0      apache-2.0/src/lib/apr/file_io/unix/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/dir.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- dir.c	2000/07/03 12:06:28	1.34
  +++ dir.c	2000/07/21 19:50:39	1.35
  @@ -53,6 +53,7 @@
    */
   
   #include "fileio.h"
  +#include "apr_strings.h"
   #include "apr_portable.h"
   
   static ap_status_t dir_cleanup(void *thedir)
  
  
  
  1.32      +1 -0      apache-2.0/src/lib/apr/file_io/unix/fileacc.c
  
  Index: fileacc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/fileacc.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- fileacc.c	2000/07/08 11:31:46	1.31
  +++ fileacc.c	2000/07/21 19:50:39	1.32
  @@ -52,6 +52,7 @@
    * <http://www.apache.org/>.
    */
   
  +#include "apr_strings.h"
   #ifdef OS2
   #include "../os2/fileio.h"
   #elif defined(WIN32)
  
  
  
  1.24      +1 -0      apache-2.0/src/lib/apr/file_io/unix/filedup.c
  
  Index: filedup.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/filedup.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- filedup.c	2000/06/20 19:36:21	1.23
  +++ filedup.c	2000/07/21 19:50:39	1.24
  @@ -53,6 +53,7 @@
    */
   
   #include "fileio.h"
  +#include "apr_strings.h"
   #include "apr_portable.h"
   
   ap_status_t ap_dupfile(ap_file_t **new_file, ap_file_t *old_file, ap_pool_t *p)
  
  
  
  1.62      +1 -0      apache-2.0/src/lib/apr/file_io/unix/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/open.c,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- open.c	2000/07/07 02:16:01	1.61
  +++ open.c	2000/07/21 19:50:39	1.62
  @@ -53,6 +53,7 @@
    */
   
   #include "fileio.h"
  +#include "apr_strings.h"
   #include "apr_portable.h"
   
   ap_status_t ap_unix_file_cleanup(void *thefile)
  
  
  
  1.37      +1 -0      apache-2.0/src/lib/apr/file_io/unix/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/pipe.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- pipe.c	2000/07/03 12:06:30	1.36
  +++ pipe.c	2000/07/21 19:50:39	1.37
  @@ -53,6 +53,7 @@
    */
   
   #include "fileio.h"
  +#include "apr_strings.h"
   
   static ap_status_t pipeblock(ap_file_t *thepipe)
   {
  
  
  
  1.9       +1 -0      apache-2.0/src/lib/apr/i18n/unix/xlate.c
  
  Index: xlate.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/i18n/unix/xlate.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- xlate.c	2000/06/14 20:38:18	1.8
  +++ xlate.c	2000/07/21 19:50:41	1.9
  @@ -55,6 +55,7 @@
   #include "apr_private.h"
   
   #include "apr_lib.h"
  +#include "apr_strings.h"
   #include "apr_xlate.h"
   
   /* If no implementation is available, don't generate code here since
  
  
  
  1.35      +0 -22     apache-2.0/src/lib/apr/include/apr_lib.h
  
  Index: apr_lib.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_lib.h,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- apr_lib.h	2000/07/05 04:23:15	1.34
  +++ apr_lib.h	2000/07/21 19:50:41	1.35
  @@ -368,28 +368,6 @@
   APR_EXPORT(void) ap_note_subprocess(struct ap_pool_t *a, ap_proc_t *pid,
   				     enum kill_conditions how);
   
  -/*
  -
  -=head1 char *ap_cpystrn(char *dst, const char *src, size_t dst_size)
  -
  -B<copy n characters from src to dest>
  -
  -    arg 1) The destination string 
  -    arg 2) The source string
  -    arg 3) The number of characters to copy
  -
  -B<NOTE>:  We re-implement this function to implement these specific changes:
  -	1) strncpy() doesn't always null terminate and we want it to.
  -	2) strncpy() null fills, which is bogus, esp. when copy 8byte strings
  -	   into 8k blocks.
  -	3) Instead of returning the pointer to the beginning of the
  -	   destination string, we return a pointer to the terminating '\0'
  -	   to allow us to check for truncation.
  -
  -=cut
  - */
  -APR_EXPORT(char *) ap_cpystrn(char *dst, const char *src, size_t dst_size);
  -
   #ifdef __cplusplus
   }
   #endif
  
  
  
  1.25      +0 -73     apache-2.0/src/lib/apr/include/apr_pools.h
  
  Index: apr_pools.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_pools.h,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- apr_pools.h	2000/07/08 11:57:15	1.24
  +++ apr_pools.h	2000/07/21 19:50:41	1.25
  @@ -266,79 +266,6 @@
   
   /*
   
  -=head1 char *ap_pstrdup(ap_pool_t *c, const char *s)
  -
  -B<duplicate a string into memory allocated out of a pool>
  -
  -    arg 1) The pool to allocate out of 
  -    arg 2) The string to allocate
  -    return) The new string
  -
  -=cut
  - */
  -APR_EXPORT(char *) ap_pstrdup(ap_pool_t *p, const char *s);
  -
  -/*
  -
  -=head1 char *ap_pstrndup(ap_pool_t *c, const char *s, ap_size_t n)
  -
  -B<duplicate the first n characters ofa string into memory allocated out of a pool>
  -
  -    arg 1) The pool to allocate out of 
  -    arg 2) The string to allocate
  -    arg 3) The number of characters to duplicate
  -    return) The new string
  -
  -=cut
  - */
  -APR_EXPORT(char *) ap_pstrndup(ap_pool_t *p, const char *s, ap_size_t n);
  -
  -/*
  -
  -=head1 char *ap_pstrcat(ap_pool_t *c, ...)
  -
  -B<Concatenate multiple strings, allocating memory out a pool>
  -
  -    arg 1) The pool to allocate out of 
  -    ...) The strings to concatenate.  The final string must be NULL
  -    return) The new string
  -
  -=cut
  - */
  -APR_EXPORT_NONSTD(char *) ap_pstrcat(ap_pool_t *p, ...);
  -
  -/*
  -
  -=head1 char *ap_pvsprintf(ap_pool_t *c, const char *fmt, va_list ap)
  -
  -B<printf-style style printing routine.  The data is output to a string allocated from a pool>
  -
  -    arg 1) The pool to allocate out of 
  -    arg 2) The format of the string
  -    arg 3) The arguments to use while printing the data
  -    return) The new string
  -
  -=cut
  - */
  -APR_EXPORT(char *) ap_pvsprintf(ap_pool_t *p, const char *fmt, va_list ap);
  -
  -/*
  -
  -=head1 char *ap_psprintf(ap_pool_t *c, const char *fmt, ...)
  -
  -B<printf-style style printing routine.  The data is output to a string allocated from a pool>
  -
  -    arg 1) The pool to allocate out of 
  -    arg 2) The format of the string
  -    ...) The arguments to use while printing the data
  -    return) The new string
  -
  -=cut
  - */
  -APR_EXPORT_NONSTD(char *) ap_psprintf(ap_pool_t *p, const char *fmt, ...);
  -
  -/*
  -
   =head1 void ap_register_cleanup(ap_pool_t *p, const void *data,
                                   ap_status_t (*plain_cleanup)(void *),
                                   ap_status_t (*child_cleanup)(void *))
  
  
  
  1.1                  apache-2.0/src/lib/apr/include/apr_strings.h
  
  Index: apr_strings.h
  ===================================================================
  /* -*- mode: c; c-file-style: "k&r" -*-
  
    strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
    Copyright (C) 2000 by Martin Pool <mb...@humbug.org.au>
  
    This software is provided 'as-is', without any express or implied
    warranty.  In no event will the authors be held liable for any damages
    arising from the use of this software.
  
    Permission is granted to anyone to use this software for any purpose,
    including commercial applications, and to alter it and redistribute it
    freely, subject to the following restrictions:
  
    1. The origin of this software must not be misrepresented; you must not
       claim that you wrote the original software. If you use this software
       in a product, an acknowledgment in the product documentation would be
       appreciated but is not required.
    2. Altered source versions must be plainly marked as such, and must not be
       misrepresented as being the original software.
    3. This notice may not be removed or altered from any source distribution.
  */
  
  #include "apr.h"
  #include "apr_lib.h"
  
  #ifndef APR_STRINGS_H
  #define APR_STRINGS_H
  
  #ifdef __cplusplus
  extern "C" {
  #endif /* __cplusplus */
  
  /*
  
  =head1 int ap_strnatcmp(char const *a, char const *b)
  
  B<Do a natural order comparison of two strings.>
  
      arg 1) The first string to compare
      arg 2) The second string to compare
      return) Either <0, 0, or >0.  If the first string is less than the second
              this returns <0, if they are equivalent it returns 0, and if the
              first string is greater than second string it retuns >0.
  
  =cut
   */
  int ap_strnatcmp(char const *a, char const *b);
  
  /*
  
  =head1 int ap_strnatcmp(char const *a, char const *b)
  
  B<Do a natural order comparison of two strings ignoring the case of the strings.>
  
      arg 1) The first string to compare
      arg 2) The second string to compare
      return) Either <0, 0, or >0.  If the first string is less than the second
              this returns <0, if they are equivalent it returns 0, and if the
              first string is greater than second string it retuns >0.
  
  =cut
   */
  int ap_strnatcasecmp(char const *a, char const *b);
  
  /*
  
  =head1 char *ap_pstrdup(ap_pool_t *c, const char *s)
  
  B<duplicate a string into memory allocated out of a pool>
  
      arg 1) The pool to allocate out of
      arg 2) The string to allocate
      return) The new string
  
  =cut
   */
  APR_EXPORT(char *) ap_pstrdup(ap_pool_t *p, const char *s);
  
  /*
  
  =head1 char *ap_pstrndup(ap_pool_t *c, const char *s, ap_size_t n)
  
  B<duplicate the first n characters ofa string into memory allocated out of a poo
  l>
  
      arg 1) The pool to allocate out of
      arg 2) The string to allocate
      arg 3) The number of characters to duplicate
      return) The new string
  
  =cut
   */
  APR_EXPORT(char *) ap_pstrndup(ap_pool_t *p, const char *s, ap_size_t n);
  
  /*
  =head1 char *ap_pstrcat(ap_pool_t *c, ...)
  
  B<Concatenate multiple strings, allocating memory out a pool>
  
      arg 1) The pool to allocate out of
      ...) The strings to concatenate.  The final string must be NULL
      return) The new string
  
  =cut
   */
  APR_EXPORT_NONSTD(char *) ap_pstrcat(ap_pool_t *p, ...);
  
  /*
  
  =head1 char *ap_pvsprintf(ap_pool_t *c, const char *fmt, va_list ap)
  B<printf-style style printing routine.  The data is output to a string allocated
   from a pool>
  
      arg 1) The pool to allocate out of
      arg 2) The format of the string
      arg 3) The arguments to use while printing the data
      return) The new string
  
  =cut
   */
  APR_EXPORT(char *) ap_pvsprintf(ap_pool_t *p, const char *fmt, va_list ap);
  
  /*
  
  =head1 char *ap_psprintf(ap_pool_t *c, const char *fmt, ...)
  
  B<printf-style style printing routine.  The data is output to a string allocated from a pool>
  
      arg 1) The pool to allocate out of
      arg 2) The format of the string
      ...) The arguments to use while printing the data
      return) The new string
  
  =cut
   */
  APR_EXPORT_NONSTD(char *) ap_psprintf(ap_pool_t *p, const char *fmt, ...);
  
  /*
  
  =head1 char *ap_cpystrn(char *dst, const char *src, size_t dst_size)
  
  B<copy n characters from src to dest>
  
      arg 1) The destination string
      arg 2) The source string
      arg 3) The number of characters to copy
  
  B<NOTE>:  We re-implement this function to implement these specific changes:
          1) strncpy() doesn't always null terminate and we want it to.
          2) strncpy() null fills, which is bogus, esp. when copy 8byte strings
             into 8k blocks.
          3) Instead of returning the pointer to the beginning of the
             destination string, we return a pointer to the terminating '\0'
             to allow us to check for truncation.
  
  =cut
   */
  APR_EXPORT(char *) ap_cpystrn(char *dst, const char *src, size_t dst_size);
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif  /* !APR_STRINGS_H */
  
  
  
  1.23      +2 -5      apache-2.0/src/lib/apr/lib/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/Makefile.in,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Makefile.in	2000/07/07 19:20:45	1.22
  +++ Makefile.in	2000/07/21 19:50:41	1.23
  @@ -16,17 +16,14 @@
   
   #LIB=@LIBPREFIX@apr.a
   
  -OBJS=apr_cpystrn.o \
  -	apr_fnmatch.o \
  +OBJS=apr_fnmatch.o \
   	apr_execve.o \
   	apr_md5.o \
   	apr_pools.o \
   	apr_signal.o \
  -	apr_snprintf.o \
   	apr_tables.o \
   	apr_hash.o \
  -	apr_getpass.o \
  -	apr_strnatcmp.o
  +	apr_getpass.o
   
   .c.o:
   	$(CC) $(CFLAGS) -c $(INCLUDES) $<
  
  
  
  1.16      +1 -0      apache-2.0/src/lib/apr/lib/apr_getpass.c
  
  Index: apr_getpass.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_getpass.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- apr_getpass.c	2000/05/26 16:23:25	1.15
  +++ apr_getpass.c	2000/07/21 19:50:42	1.16
  @@ -58,6 +58,7 @@
    * use one we define ourselves.
    */
   #include "apr_private.h"
  +#include "apr_strings.h"
   #include "apr_lib.h"
   #include "apr_errno.h"
   #include <sys/types.h>
  
  
  
  1.17      +1 -0      apache-2.0/src/lib/apr/lib/apr_md5.c
  
  Index: apr_md5.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_md5.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- apr_md5.c	2000/06/17 11:32:37	1.16
  +++ apr_md5.c	2000/07/21 19:50:42	1.17
  @@ -98,6 +98,7 @@
   #ifndef WIN32
   #include "apr_private.h"
   #endif
  +#include "apr_strings.h"
   #include "apr_md5.h"
   #include "apr_lib.h"
   
  
  
  
  1.64      +1 -66     apache-2.0/src/lib/apr/lib/apr_pools.c
  
  Index: apr_pools.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_pools.c,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- apr_pools.c	2000/07/08 11:57:15	1.63
  +++ apr_pools.c	2000/07/21 19:50:42	1.64
  @@ -63,6 +63,7 @@
   #include "apr_private.h"
   
   #include "apr_portable.h" /* for get_os_proc */
  +#include "apr_strings.h"
   #include "apr_general.h"
   #include "apr_pools.h"
   #include "apr_lib.h"
  @@ -950,72 +951,6 @@
   {
       void *res = ap_palloc(a, size);
       memset(res, '\0', size);
  -    return res;
  -}
  -
  -APR_EXPORT(char *) ap_pstrdup(ap_pool_t *a, const char *s)
  -{
  -    char *res;
  -    size_t len;
  -
  -    if (s == NULL) {
  -	return NULL;
  -    }
  -    len = strlen(s) + 1;
  -    res = ap_palloc(a, len);
  -    memcpy(res, s, len);
  -    return res;
  -}
  -
  -APR_EXPORT(char *) ap_pstrndup(ap_pool_t *a, const char *s, ap_size_t n)
  -{
  -    char *res;
  -
  -    if (s == NULL) {
  -	return NULL;
  -    }
  -    res = ap_palloc(a, n + 1);
  -    memcpy(res, s, n);
  -    res[n] = '\0';
  -    return res;
  -}
  -
  -APR_EXPORT_NONSTD(char *) ap_pstrcat(ap_pool_t *a, ...)
  -{
  -    char *cp, *argp, *res;
  -
  -    /* Pass one --- find length of required string */
  -
  -    ap_size_t len = 0;
  -    va_list adummy;
  -
  -    va_start(adummy, a);
  -
  -    while ((cp = va_arg(adummy, char *)) != NULL) {
  -	len += strlen(cp);
  -    }
  -
  -    va_end(adummy);
  -
  -    /* Allocate the required string */
  -
  -    res = (char *) ap_palloc(a, len + 1);
  -    cp = res;
  -    *cp = '\0';
  -
  -    /* Pass two --- copy the argument strings into the result space */
  -
  -    va_start(adummy, a);
  -
  -    while ((argp = va_arg(adummy, char *)) != NULL) {
  -	strcpy(cp, argp);
  -	cp += strlen(argp);
  -    }
  -
  -    va_end(adummy);
  -
  -    /* Return the result string */
  -
       return res;
   }
   
  
  
  
  1.23      +1 -0      apache-2.0/src/lib/apr/lib/apr_tables.c
  
  Index: apr_tables.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_tables.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- apr_tables.c	2000/07/05 20:23:20	1.22
  +++ apr_tables.c	2000/07/21 19:50:42	1.23
  @@ -64,6 +64,7 @@
   #include "apr_general.h"
   #include "apr_pools.h"
   #include "apr_tables.h"
  +#include "apr_strings.h"
   #include "apr_lib.h"
   #include "misc.h"
   #ifdef HAVE_STDLIB_H
  
  
  
  1.35      +1 -0      apache-2.0/src/lib/apr/locks/unix/crossproc.c
  
  Index: crossproc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/unix/crossproc.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- crossproc.c	2000/07/21 16:48:28	1.34
  +++ crossproc.c	2000/07/21 19:50:43	1.35
  @@ -53,6 +53,7 @@
    */
   
   #include "apr.h"
  +#include "apr_strings.h"
   #include "locks.h"
   
   #if APR_USE_SYSVSEM_SERIALIZE  
  
  
  
  1.38      +1 -0      apache-2.0/src/lib/apr/locks/unix/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/unix/locks.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- locks.c	2000/07/19 17:42:55	1.37
  +++ locks.c	2000/07/21 19:50:43	1.38
  @@ -53,6 +53,7 @@
    */
   
   #include "locks.h"
  +#include "apr_strings.h"
   #include "apr_portable.h"
   
   ap_status_t ap_create_lock(ap_lock_t **lock, ap_locktype_e type, 
  
  
  
  1.23      +1 -0      apache-2.0/src/lib/apr/misc/unix/errorcodes.c
  
  Index: errorcodes.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/misc/unix/errorcodes.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- errorcodes.c	2000/07/05 16:32:29	1.22
  +++ errorcodes.c	2000/07/21 19:50:44	1.23
  @@ -53,6 +53,7 @@
    */
   
   #include "misc.h"
  +#include "apr_strings.h"
   #include "apr_lib.h"
   #include "apr_dso.h"
   
  
  
  
  1.37      +1 -0      apache-2.0/src/lib/apr/misc/unix/start.c
  
  Index: start.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/misc/unix/start.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- start.c	2000/07/08 11:59:48	1.36
  +++ start.c	2000/07/21 19:50:44	1.37
  @@ -54,6 +54,7 @@
   
   #include "misc.h"
   #include "locks.h"
  +#include "apr_strings.h"
   
   ap_status_t ap_create_pool(ap_pool_t **newcont, ap_pool_t *cont)
   {
  
  
  
  1.14      +1 -0      apache-2.0/src/lib/apr/network_io/unix/sockaddr.c
  
  Index: sockaddr.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockaddr.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- sockaddr.c	2000/06/28 22:36:28	1.13
  +++ sockaddr.c	2000/07/21 19:50:44	1.14
  @@ -53,6 +53,7 @@
    */
   
   #include "networkio.h"
  +#include "apr_strings.h"
   
   ap_status_t ap_set_local_port(ap_socket_t *sock, ap_uint32_t port)
   {
  
  
  
  1.31      +1 -0      apache-2.0/src/lib/apr/network_io/unix/sockopt.c
  
  Index: sockopt.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockopt.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- sockopt.c	2000/06/27 02:23:29	1.30
  +++ sockopt.c	2000/07/21 19:50:44	1.31
  @@ -53,6 +53,7 @@
    */
   
   #include "networkio.h"
  +#include "apr_strings.h"
   
   static ap_status_t soblock(int sd)
   {
  
  
  
  1.1                  apache-2.0/src/lib/apr/strings/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  Makefile
  
  
  
  1.1                  apache-2.0/src/lib/apr/strings/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  #CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
  #LIBS=$(EXTRA_LIBS) $(LIBS1)
  #INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
  #LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
  
  CC=@CC@
  RANLIB=@RANLIB@
  AR=@AR@
  RM=@RM@
  CFLAGS=@CFLAGS@ @OPTIM@
  LIBS=@LIBS@
  LDFLAGS=@LDFLAGS@ $(LIBS)
  INCDIR=../include
  INCDIR1=../misc/@OSDIR@
  INCLUDES=-I$(INCDIR) -I$(INCDIR1) -I../misc/unix
  
  #LIB=@LIBPREFIX@apr.a
  
  OBJS=apr_cpystrn.o \
  	apr_snprintf.o \
  	apr_strnatcmp.o \
  	apr_strings.o
  
  .c.o:
  	$(CC) $(CFLAGS) -c $(INCLUDES) $<
  
  all: $(OBJS)
  
  clean:
  	$(RM) -f *.o *.a *.so
  
  distclean: clean
  	-$(RM) -f Makefile
  
  
  #$(LIB): $(OBJS)
  #	$(RM) -f $@
  #	$(AR) cr $@ $(OBJS)
  #	$(RANLIB) $@
  
  #
  # We really don't expect end users to use this rule.  It works only with
  # gcc, and rebuilds Makefile.in.  You have to re-run configure after
  # using it.
  #
  depend:
  	cp Makefile.in Makefile.in.bak \
  	    && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.in > Makefile.new \
  	    && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
  	    && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \
  	           -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \
  		> Makefile.in \
  	    && rm Makefile.new
  
  # DO NOT REMOVE
  apr_cpystrn.o: apr_cpystrn.c $(INCDIR)/apr.h $(INCDIR)/apr_private.h \
   $(INCDIR)/apr_lib.h $(INCDIR)/apr_pools.h \
   $(INCDIR)/apr_thread_proc.h $(INCDIR)/apr_file_io.h \
   $(INCDIR)/apr_general.h $(INCDIR)/apr_errno.h $(INCDIR)/apr_time.h \
   $(INCDIR)/apr_tables.h
  apr_execve.o: apr_execve.c $(INCDIR)/apr_private.h
  apr_fnmatch.o: apr_fnmatch.c $(INCDIR)/apr_private.h \
   $(INCDIR)/apr_fnmatch.h $(INCDIR)/apr_errno.h $(INCDIR)/apr.h \
   $(INCDIR)/apr_lib.h $(INCDIR)/apr_pools.h \
   $(INCDIR)/apr_thread_proc.h $(INCDIR)/apr_file_io.h \
   $(INCDIR)/apr_general.h $(INCDIR)/apr_time.h \
   $(INCDIR)/apr_tables.h
  apr_getpass.o: apr_getpass.c $(INCDIR)/apr_private.h \
   $(INCDIR)/apr_lib.h $(INCDIR)/apr.h $(INCDIR)/apr_pools.h \
   $(INCDIR)/apr_thread_proc.h $(INCDIR)/apr_file_io.h \
   $(INCDIR)/apr_general.h $(INCDIR)/apr_errno.h $(INCDIR)/apr_time.h \
   $(INCDIR)/apr_tables.h
  apr_hash.o: apr_hash.c $(INCDIR)/apr_private.h \
   $(INCDIR)/apr_general.h $(INCDIR)/apr.h $(INCDIR)/apr_errno.h \
   $(INCDIR)/apr_pools.h $(INCDIR)/apr_thread_proc.h \
   $(INCDIR)/apr_file_io.h $(INCDIR)/apr_time.h $(INCDIR)/apr_hash.h
  apr_md5.o: apr_md5.c $(INCDIR)/apr_private.h $(INCDIR)/apr_md5.h \
   $(INCDIR)/apr_lib.h $(INCDIR)/apr.h $(INCDIR)/apr_pools.h \
   $(INCDIR)/apr_thread_proc.h $(INCDIR)/apr_file_io.h \
   $(INCDIR)/apr_general.h $(INCDIR)/apr_errno.h $(INCDIR)/apr_time.h \
   $(INCDIR)/apr_tables.h $(INCDIR)/apr_xlate.h
  apr_pools.o: apr_pools.c $(INCDIR)/apr.h $(INCDIR)/apr_private.h \
   $(INCDIR)/apr_portable.h $(INCDIR)/apr_general.h \
   $(INCDIR)/apr_errno.h $(INCDIR)/apr_thread_proc.h \
   $(INCDIR)/apr_file_io.h $(INCDIR)/apr_time.h \
   $(INCDIR)/apr_network_io.h $(INCDIR)/apr_lock.h \
   $(INCDIR)/apr_dso.h $(INCDIR)/apr_pools.h $(INCDIR)/apr_lib.h \
   $(INCDIR)/apr_tables.h ../misc/unix/misc.h $(INCDIR)/apr_getopt.h
  apr_signal.o: apr_signal.c $(INCDIR)/apr_private.h \
   $(INCDIR)/apr_lib.h $(INCDIR)/apr.h $(INCDIR)/apr_pools.h \
   $(INCDIR)/apr_thread_proc.h $(INCDIR)/apr_file_io.h \
   $(INCDIR)/apr_general.h $(INCDIR)/apr_errno.h $(INCDIR)/apr_time.h \
   $(INCDIR)/apr_tables.h
  apr_snprintf.o: apr_snprintf.c $(INCDIR)/apr.h \
   $(INCDIR)/apr_private.h $(INCDIR)/apr_lib.h $(INCDIR)/apr_pools.h \
   $(INCDIR)/apr_thread_proc.h $(INCDIR)/apr_file_io.h \
   $(INCDIR)/apr_general.h $(INCDIR)/apr_errno.h $(INCDIR)/apr_time.h \
   $(INCDIR)/apr_tables.h
  apr_strnatcmp.o: apr_strnatcmp.c $(INCDIR)/apr_strnatcmp.h
  apr_tables.o: apr_tables.c $(INCDIR)/apr_private.h \
   $(INCDIR)/apr_general.h $(INCDIR)/apr.h $(INCDIR)/apr_errno.h \
   $(INCDIR)/apr_pools.h $(INCDIR)/apr_thread_proc.h \
   $(INCDIR)/apr_file_io.h $(INCDIR)/apr_time.h \
   $(INCDIR)/apr_tables.h $(INCDIR)/apr_lib.h ../misc/unix/misc.h \
   $(INCDIR)/apr_getopt.h
  
  
  
  1.1                  apache-2.0/src/lib/apr/strings/apr_cpystrn.c
  
  Index: apr_cpystrn.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. 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.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
   * ITS 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.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #include "apr.h"
  #include "apr_strings.h"
  #include "apr_private.h"
  #include "apr_lib.h"
  
  #if APR_HAVE_SYS_TYPES_H
  #include <sys/types.h>
  #endif
  #if HAVE_STRING_H
  #include <string.h>
  #endif
  #if HAVE_CTYPE_H
  #include <ctype.h>
  #endif
  
  /*
   * Apache's "replacement" for the strncpy() function. We roll our
   * own to implement these specific changes:
   *   (1) strncpy() doesn't always null terminate and we want it to.
   *   (2) strncpy() null fills, which is bogus, esp. when copy 8byte
   *       strings into 8k blocks.
   *   (3) Instead of returning the pointer to the beginning of
   *       the destination string, we return a pointer to the
   *       terminating '\0' to allow us to "check" for truncation
   *
   * ap_cpystrn() follows the same call structure as strncpy().
   */
  
  APR_EXPORT(char *) ap_cpystrn(char *dst, const char *src, size_t dst_size)
  {
  
      char *d, *end;
  
      if (dst_size == 0) {
          return (dst);
      }
  
      d = dst;
      end = dst + dst_size - 1;
  
      for (; d < end; ++d, ++src) {
  	if (!(*d = *src)) {
  	    return (d);
  	}
      }
  
      *d = '\0';	/* always null terminate */
  
      return (d);
  }
  
  
  /*
   * This function provides a way to parse a generic argument string
   * into a standard argv[] form of argument list. It respects the 
   * usual "whitespace" and quoteing rules. In the future this could
   * be expanded to include support for the ap_call_exec command line
   * string processing (including converting '+' to ' ' and doing the 
   * url processing. It does not currently support this function.
   *
   *    token_context: Context from which pool allocations will occur.
   *    arg_str:       Input argument string for conversion to argv[].
   *    argv_out:      Output location. This is a pointer to an array
   *                   of pointers to strings (ie. &(char *argv[]).
   *                   This value will be allocated from the contexts
   *                   pool and filled in with copies of the tokens
   *                   found during parsing of the arg_str. 
   */
  APR_EXPORT(ap_status_t) ap_tokenize_to_argv(const char *arg_str, 
                                              char ***argv_out,
                                              ap_pool_t *token_context)
  {
      const char *cp;
      const char *tmpCnt;
      int isquoted, numargs = 0, rc = APR_SUCCESS;
  
  #define SKIP_WHITESPACE(cp) \
      for ( ; *cp == ' ' || *cp == '\t'; ) { \
          cp++; \
      };
  
  #define CHECK_QUOTATION(cp,isquoted) \
      isquoted = 0; \
      if (*cp == '"') { \
          isquoted = 1; \
          cp++; \
      }
  
  /* DETERMINE_NEXTSTRING:
   * At exit, cp will point to one of the following:  NULL, SPACE, TAB or QUOTE.
   * NULL implies the argument string has been fully traversed.
   */
  #define DETERMINE_NEXTSTRING(cp,isquoted) \
      for ( ; *cp != '\0'; cp++) { \
          if (   (isquoted    && (*cp     == ' ' || *cp     == '\t')) \
              || (*cp == '\\' && (*(cp+1) == ' ' || *(cp+1) == '\t'))) { \
              cp++; \
              continue; \
          } \
          if (   (!isquoted && (*cp == ' ' || *cp == '\t')) \
              || (isquoted  && *cp == '"')                  ) { \
              break; \
          } \
      }
  
      cp = arg_str;
      SKIP_WHITESPACE(cp);
      tmpCnt = cp;
  
      /* This is ugly and expensive, but if anyone wants to figure a
       * way to support any number of args without counting and 
       * allocating, please go ahead and change the code.
       */
      while (*tmpCnt != '\0') {
          CHECK_QUOTATION(tmpCnt, isquoted);
          DETERMINE_NEXTSTRING(tmpCnt, isquoted);
          numargs++;
          SKIP_WHITESPACE(tmpCnt);
      }
  
      *argv_out = ap_palloc(token_context, numargs*sizeof(char*));
      if (*argv_out == NULL) {
          return (APR_ENOMEM);
      }
  
      /*  determine first argument */
      numargs = 0;
      while (*cp != '\0') {
          CHECK_QUOTATION(cp, isquoted);
          tmpCnt = cp;
          DETERMINE_NEXTSTRING(cp, isquoted);
          if (*cp == '\0') {
              (*argv_out)[numargs] = ap_pstrdup(token_context, tmpCnt);
              numargs++;
              (*argv_out)[numargs] = '\0';
              break;
          }
          else {
              cp++;
              (*argv_out)[numargs] = ap_palloc(token_context, cp - tmpCnt);
              ap_cpystrn((*argv_out)[numargs], tmpCnt, cp - tmpCnt);
              numargs++;
          }
          
          SKIP_WHITESPACE(cp);
      }
  
      return(rc);
  }
  
  /* Filename_of_pathname returns the final element of the pathname.
   * Using the current platform's filename syntax.
   *   "/foo/bar/gum" -> "gum"
   *   "/foo/bar/gum/" -> ""
   *   "gum" -> "gum"
   *   "wi\\n32\\stuff" -> "stuff
   *
   * Corrected Win32 to accept "a/b\\stuff", "a:stuff"
   */
  
  APR_EXPORT(const char *) ap_filename_of_pathname(const char *pathname)
  {
      const char path_separator = '/';
      const char *s = strrchr(pathname, path_separator);
  
  #ifdef WIN32
      const char path_separator_win = '\\';
      const char drive_separator_win = ':';
      const char *s2 = strrchr(pathname, path_separator_win);
  
      if (s2 > s) s = s2;
  
      if (!s) s = strrchr(pathname, drive_separator_win);
  #endif
  
      return s ? ++s : pathname;
  }
  
  /* length of dest assumed >= length of src
   * collapse in place (src == dest) is legal.
   * returns terminating null ptr to dest string.
   */
  APR_EXPORT(char *) ap_collapse_spaces(char *dest, const char *src)
  {
      while (*src) {
          if (!ap_isspace(*src)) 
              *dest++ = *src;
          ++src;
      }
      *dest = 0;
      return (dest);
  }
  
  #if !APR_HAVE_STRDUP
  char *strdup(const char *str)
  {
      char *sdup;
      size_t len = strlen(str) + 1;
  
      if (!(sdup = (char *) malloc(len))) {
          /* ### whoops! we can't call Apache logging routines here... */
  #if 0
          ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
                       "Ouch! Out of memory in our strdup()!");
  #endif
          return NULL;
      }
      memcpy(sdup, str, len);
  
      return sdup;
  }
  #endif
  
  /* The following two routines were donated for SVR4 by Andreas Vogel */
  #if (!APR_HAVE_STRCASECMP && !APR_HAVE_STRICMP)
  int strcasecmp(const char *a, const char *b)
  {
      const char *p = a;
      const char *q = b;
      for (p = a, q = b; *p && *q; p++, q++) {
          int diff = ap_tolower(*p) - ap_tolower(*q);
          if (diff)
              return diff;
      }
      if (*p)
          return 1;               /* p was longer than q */
      if (*q)
          return -1;              /* p was shorter than q */
      return 0;                   /* Exact match */
  }
  
  #endif
  
  #if (!APR_HAVE_STRNCASECMP && !APR_HAVE_STRNICMP)
  int strncasecmp(const char *a, const char *b, size_t n)
  {
      const char *p = a;
      const char *q = b;
  
      for (p = a, q = b; /*NOTHING */ ; p++, q++) {
          int diff;
          if (p == a + n)
              return 0;           /*   Match up to n characters */
          if (!(*p && *q))
              return *p - *q;
          diff = ap_tolower(*p) - ap_tolower(*q);
          if (diff)
              return diff;
      }
      /*NOTREACHED */
  }
  #endif
  
  /* The following routine was donated for UTS21 by dwd@bell-labs.com */
  #if (!APR_HAVE_STRSTR)
  char *strstr(char *s1, char *s2)
  {
      char *p1, *p2;
      if (*s2 == '\0') {
          /* an empty s2 */
          return(s1);
      }
      while((s1 = strchr(s1, *s2)) != NULL) {
          /* found first character of s2, see if the rest matches */
          p1 = s1;
          p2 = s2;
          while (*++p1 == *++p2) {
              if (*p1 == '\0') {
                  /* both strings ended together */
                  return(s1);
              }
          }
          if (*p2 == '\0') {
              /* second string ended, a match */
              break;
          }
          /* didn't find a match here, try starting at next character in s1 */
          s1++;
      }
      return(s1);
  }
  #endif
  
  
  
  
  1.1                  apache-2.0/src/lib/apr/strings/apr_snprintf.c
  
  Index: apr_snprintf.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. 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.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
   * ITS 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.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * The ap_vsnprintf/ap_snprintf functions are based on, and used with the
   * permission of, the  SIO stdio-replacement strx_* functions by Panos
   * Tsirigotis <pa...@alumni.cs.colorado.edu> for xinetd.
   */
  
  #include "apr.h"
  #include "apr_private.h"
  
  #include "apr_lib.h"
  #include <math.h>
  #ifdef HAVE_CTYPE_H
  #include <ctype.h>
  #endif
  #if APR_HAVE_NETINET_IN_H
  #include <netinet/in.h>
  #endif
  #ifdef HAVE_SYS_SOCKET_H
  #include <sys/socket.h>
  #endif
  #ifdef HAVE_ARPA_INET_H
  #include <arpa/inet.h>
  #endif
  #ifdef HAVE_LIMITS_H
  #include <limits.h>
  #endif
  #ifdef HAVE_STRING_H
  #include <string.h>
  #endif
  
  typedef enum {
      NO = 0, YES = 1
  } boolean_e;
  
  #ifndef FALSE
  #define FALSE			0
  #endif
  #ifndef TRUE
  #define TRUE			1
  #endif
  #ifndef AP_LONGEST_LONG
  #define AP_LONGEST_LONG		long
  #endif
  #define NUL			'\0'
  #define WIDE_INT		long
  #define WIDEST_INT		AP_LONGEST_LONG
  
  typedef WIDE_INT wide_int;
  typedef unsigned WIDE_INT u_wide_int;
  typedef WIDEST_INT widest_int;
  #ifdef __TANDEM
  /* Although Tandem supports "long long" there is no unsigned variant. */
  typedef unsigned long       u_widest_int;
  #else
  typedef unsigned WIDEST_INT u_widest_int;
  #endif
  typedef int bool_int;
  
  #define S_NULL			"(null)"
  #define S_NULL_LEN		6
  
  #define FLOAT_DIGITS		6
  #define EXPONENT_LENGTH		10
  
  /*
   * NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions
   *
   * XXX: this is a magic number; do not decrease it
   */
  #define NUM_BUF_SIZE		512
  
  /*
   * cvt.c - IEEE floating point formatting routines for FreeBSD
   * from GNU libc-4.6.27.  Modified to be thread safe.
   */
  
  /*
   *    ap_ecvt converts to decimal
   *      the number of digits is specified by ndigit
   *      decpt is set to the position of the decimal point
   *      sign is set to 0 for positive, 1 for negative
   */
  
  #define	NDIG	80
  
  /* buf must have at least NDIG bytes */
  static char *ap_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf)
  {
      register int r2;
      double fi, fj;
      register char *p, *p1;
      
      if (ndigits >= NDIG - 1)
  	ndigits = NDIG - 2;
      r2 = 0;
      *sign = 0;
      p = &buf[0];
      if (arg < 0) {
  	*sign = 1;
  	arg = -arg;
      }
      arg = modf(arg, &fi);
      p1 = &buf[NDIG];
      /*
       * Do integer part
       */
      if (fi != 0) {
  	p1 = &buf[NDIG];
  	while (fi != 0) {
  	    fj = modf(fi / 10, &fi);
  	    *--p1 = (int) ((fj + .03) * 10) + '0';
  	    r2++;
  	}
  	while (p1 < &buf[NDIG])
  	    *p++ = *p1++;
      }
      else if (arg > 0) {
  	while ((fj = arg * 10) < 1) {
  	    arg = fj;
  	    r2--;
  	}
      }
      p1 = &buf[ndigits];
      if (eflag == 0)
  	p1 += r2;
      *decpt = r2;
      if (p1 < &buf[0]) {
  	buf[0] = '\0';
  	return (buf);
      }
      while (p <= p1 && p < &buf[NDIG]) {
  	arg *= 10;
  	arg = modf(arg, &fj);
  	*p++ = (int) fj + '0';
      }
      if (p1 >= &buf[NDIG]) {
  	buf[NDIG - 1] = '\0';
  	return (buf);
      }
      p = p1;
      *p1 += 5;
      while (*p1 > '9') {
  	*p1 = '0';
  	if (p1 > buf)
  	    ++ * --p1;
  	else {
  	    *p1 = '1';
  	    (*decpt)++;
  	    if (eflag == 0) {
  		if (p > buf)
  		    *p = '0';
  		p++;
  	    }
  	}
      }
      *p = '\0';
      return (buf);
  }
  
  static char *ap_ecvt(double arg, int ndigits, int *decpt, int *sign, char *buf)
  {
      return (ap_cvt(arg, ndigits, decpt, sign, 1, buf));
  }
  
  static char *ap_fcvt(double arg, int ndigits, int *decpt, int *sign, char *buf)
  {
      return (ap_cvt(arg, ndigits, decpt, sign, 0, buf));
  }
  
  /*
   * ap_gcvt  - Floating output conversion to
   * minimal length string
   */
  
  static char *ap_gcvt(double number, int ndigit, char *buf, boolean_e altform)
  {
      int sign, decpt;
      register char *p1, *p2;
      register int i;
      char buf1[NDIG];
  
      p1 = ap_ecvt(number, ndigit, &decpt, &sign, buf1);
      p2 = buf;
      if (sign)
  	*p2++ = '-';
      for (i = ndigit - 1; i > 0 && p1[i] == '0'; i--)
  	ndigit--;
      if ((decpt >= 0 && decpt - ndigit > 4)
  	|| (decpt < 0 && decpt < -3)) {		/* use E-style */
  	decpt--;
  	*p2++ = *p1++;
  	*p2++ = '.';
  	for (i = 1; i < ndigit; i++)
  	    *p2++ = *p1++;
  	*p2++ = 'e';
  	if (decpt < 0) {
  	    decpt = -decpt;
  	    *p2++ = '-';
  	}
  	else
  	    *p2++ = '+';
  	if (decpt / 100 > 0)
  	    *p2++ = decpt / 100 + '0';
  	if (decpt / 10 > 0)
  	    *p2++ = (decpt % 100) / 10 + '0';
  	*p2++ = decpt % 10 + '0';
      }
      else {
  	if (decpt <= 0) {
  	    if (*p1 != '0')
  		*p2++ = '.';
  	    while (decpt < 0) {
  		decpt++;
  		*p2++ = '0';
  	    }
  	}
  	for (i = 1; i <= ndigit; i++) {
  	    *p2++ = *p1++;
  	    if (i == decpt)
  		*p2++ = '.';
  	}
  	if (ndigit < decpt) {
  	    while (ndigit++ < decpt)
  		*p2++ = '0';
  	    *p2++ = '.';
  	}
      }
      if (p2[-1] == '.' && !altform)
  	p2--;
      *p2 = '\0';
      return (buf);
  }
  
  /*
   * The INS_CHAR macro inserts a character in the buffer and writes
   * the buffer back to disk if necessary
   * It uses the char pointers sp and bep:
   *      sp points to the next available character in the buffer
   *      bep points to the end-of-buffer+1
   * While using this macro, note that the nextb pointer is NOT updated.
   *
   * NOTE: Evaluation of the c argument should not have any side-effects
   */
  #define INS_CHAR(c, sp, bep, cc)				\
  	    {							\
  		if (sp >= bep) {				\
  		    vbuff->curpos = sp;                         \
  		    if (flush_func(vbuff))			\
  			return -1;				\
  		    sp = vbuff->curpos;				\
  		    bep = vbuff->endpos;			\
  		} 						\
  		*sp++ = (c);					\
  		cc++; 						\
  	    }
  
  #define NUM( c )			( c - '0' )
  
  #define STR_TO_DEC( str, num )		\
      num = NUM( *str++ ) ;		\
      while ( ap_isdigit( *str ) )		\
      {					\
  	num *= 10 ;			\
  	num += NUM( *str++ ) ;		\
      }
  
  /*
   * This macro does zero padding so that the precision
   * requirement is satisfied. The padding is done by
   * adding '0's to the left of the string that is going
   * to be printed.
   */
  #define FIX_PRECISION( adjust, precision, s, s_len )	\
      if ( adjust )					\
  	while ( s_len < precision )			\
  	{						\
  	    *--s = '0' ;				\
  	    s_len++ ;					\
  	}
  
  /*
   * Macro that does padding. The padding is done by printing
   * the character ch.
   */
  #define PAD( width, len, ch )	do		\
  	{					\
  	    INS_CHAR( ch, sp, bep, cc ) ;	\
  	    width-- ;				\
  	}					\
  	while ( width > len )
  
  /*
   * Prefix the character ch to the string str
   * Increase length
   * Set the has_prefix flag
   */
  #define PREFIX( str, length, ch )	 *--str = ch ; length++ ; has_prefix = YES
  
  
  /*
   * Convert num to its decimal format.
   * Return value:
   *   - a pointer to a string containing the number (no sign)
   *   - len contains the length of the string
   *   - is_negative is set to TRUE or FALSE depending on the sign
   *     of the number (always set to FALSE if is_unsigned is TRUE)
   *
   * The caller provides a buffer for the string: that is the buf_end argument
   * which is a pointer to the END of the buffer + 1 (i.e. if the buffer
   * is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
   *
   * Note: we have 2 versions. One is used when we need to use quads
   * (conv_10_quad), the other when we don't (conv_10). We're assuming the
   * latter is faster.
   */
  static char *conv_10(register wide_int num, register bool_int is_unsigned,
  		     register bool_int *is_negative, char *buf_end,
  		     register int *len)
  {
      register char *p = buf_end;
      register u_wide_int magnitude;
  
      if (is_unsigned) {
  	magnitude = (u_wide_int) num;
  	*is_negative = FALSE;
      }
      else {
  	*is_negative = (num < 0);
  
  	/*
  	 * On a 2's complement machine, negating the most negative integer 
  	 * results in a number that cannot be represented as a signed integer.
  	 * Here is what we do to obtain the number's magnitude:
  	 *      a. add 1 to the number
  	 *      b. negate it (becomes positive)
  	 *      c. convert it to unsigned
  	 *      d. add 1
  	 */
  	if (*is_negative) {
  	    wide_int t = num + 1;
  
  	    magnitude = ((u_wide_int) -t) + 1;
  	}
  	else
  	    magnitude = (u_wide_int) num;
      }
  
      /*
       * We use a do-while loop so that we write at least 1 digit 
       */
      do {
  	register u_wide_int new_magnitude = magnitude / 10;
  
  	*--p = (char) (magnitude - new_magnitude * 10 + '0');
  	magnitude = new_magnitude;
      }
      while (magnitude);
  
      *len = buf_end - p;
      return (p);
  }
  
  static char *conv_10_quad(widest_int num, register bool_int is_unsigned,
  		     register bool_int *is_negative, char *buf_end,
  		     register int *len)
  {
      register char *p = buf_end;
      u_widest_int magnitude;
  
      /*
       * We see if we can use the faster non-quad version by checking the
       * number against the largest long value it can be. If <=, we
       * punt to the quicker version.
       */
      if ((num <= ULONG_MAX && is_unsigned) || (num <= LONG_MAX && !is_unsigned))
      	return(conv_10( (wide_int)num, is_unsigned, is_negative,
  	       buf_end, len));
  
      if (is_unsigned) {
  	magnitude = (u_widest_int) num;
  	*is_negative = FALSE;
      }
      else {
  	*is_negative = (num < 0);
  
  	/*
  	 * On a 2's complement machine, negating the most negative integer 
  	 * results in a number that cannot be represented as a signed integer.
  	 * Here is what we do to obtain the number's magnitude:
  	 *      a. add 1 to the number
  	 *      b. negate it (becomes positive)
  	 *      c. convert it to unsigned
  	 *      d. add 1
  	 */
  	if (*is_negative) {
  	    widest_int t = num + 1;
  
  	    magnitude = ((u_widest_int) -t) + 1;
  	}
  	else
  	    magnitude = (u_widest_int) num;
      }
  
      /*
       * We use a do-while loop so that we write at least 1 digit 
       */
      do {
  	u_widest_int new_magnitude = magnitude / 10;
  
  	*--p = (char) (magnitude - new_magnitude * 10 + '0');
  	magnitude = new_magnitude;
      }
      while (magnitude);
  
      *len = buf_end - p;
      return (p);
  }
  
  
  
  static char *conv_in_addr(struct in_addr *ia, char *buf_end, int *len)
  {
      unsigned addr = ntohl(ia->s_addr);
      char *p = buf_end;
      bool_int is_negative;
      int sub_len;
  
      p = conv_10((addr & 0x000000FF)      , TRUE, &is_negative, p, &sub_len);
      *--p = '.';
      p = conv_10((addr & 0x0000FF00) >>  8, TRUE, &is_negative, p, &sub_len);
      *--p = '.';
      p = conv_10((addr & 0x00FF0000) >> 16, TRUE, &is_negative, p, &sub_len);
      *--p = '.';
      p = conv_10((addr & 0xFF000000) >> 24, TRUE, &is_negative, p, &sub_len);
  
      *len = buf_end - p;
      return (p);
  }
  
  
  
  static char *conv_sockaddr_in(struct sockaddr_in *si, char *buf_end, int *len)
  {
      char *p = buf_end;
      bool_int is_negative;
      int sub_len;
  
      p = conv_10(ntohs(si->sin_port), TRUE, &is_negative, p, &sub_len);
      *--p = ':';
      p = conv_in_addr(&si->sin_addr, p, &sub_len);
  
      *len = buf_end - p;
      return (p);
  }
  
  
  
  /*
   * Convert a floating point number to a string formats 'f', 'e' or 'E'.
   * The result is placed in buf, and len denotes the length of the string
   * The sign is returned in the is_negative argument (and is not placed
   * in buf).
   */
  static char *conv_fp(register char format, register double num,
      boolean_e add_dp, int precision, bool_int *is_negative,
      char *buf, int *len)
  {
      register char *s = buf;
      register char *p;
      int decimal_point;
      char buf1[NDIG];
  
      if (format == 'f')
  	p = ap_fcvt(num, precision, &decimal_point, is_negative, buf1);
      else			/* either e or E format */
  	p = ap_ecvt(num, precision + 1, &decimal_point, is_negative, buf1);
  
      /*
       * Check for Infinity and NaN
       */
      if (ap_isalpha(*p)) {
  	*len = strlen(strcpy(buf, p));
  	*is_negative = FALSE;
  	return (buf);
      }
  
      if (format == 'f') {
  	if (decimal_point <= 0) {
  	    *s++ = '0';
  	    if (precision > 0) {
  		*s++ = '.';
  		while (decimal_point++ < 0)
  		    *s++ = '0';
  	    }
  	    else if (add_dp)
  		*s++ = '.';
  	}
  	else {
  	    while (decimal_point-- > 0)
  		*s++ = *p++;
  	    if (precision > 0 || add_dp)
  		*s++ = '.';
  	}
      }
      else {
  	*s++ = *p++;
  	if (precision > 0 || add_dp)
  	    *s++ = '.';
      }
  
      /*
       * copy the rest of p, the NUL is NOT copied
       */
      while (*p)
  	*s++ = *p++;
  
      if (format != 'f') {
  	char temp[EXPONENT_LENGTH];	/* for exponent conversion */
  	int t_len;
  	bool_int exponent_is_negative;
  
  	*s++ = format;		/* either e or E */
  	decimal_point--;
  	if (decimal_point != 0) {
  	    p = conv_10((wide_int) decimal_point, FALSE, &exponent_is_negative,
  			&temp[EXPONENT_LENGTH], &t_len);
  	    *s++ = exponent_is_negative ? '-' : '+';
  
  	    /*
  	     * Make sure the exponent has at least 2 digits
  	     */
  	    if (t_len == 1)
  		*s++ = '0';
  	    while (t_len--)
  		*s++ = *p++;
  	}
  	else {
  	    *s++ = '+';
  	    *s++ = '0';
  	    *s++ = '0';
  	}
      }
  
      *len = s - buf;
      return (buf);
  }
  
  
  /*
   * Convert num to a base X number where X is a power of 2. nbits determines X.
   * For example, if nbits is 3, we do base 8 conversion
   * Return value:
   *      a pointer to a string containing the number
   *
   * The caller provides a buffer for the string: that is the buf_end argument
   * which is a pointer to the END of the buffer + 1 (i.e. if the buffer
   * is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
   *
   * As with conv_10, we have a faster version which is used when
   * the number isn't quad size.
   */
  static char *conv_p2(register u_wide_int num, register int nbits,
  		     char format, char *buf_end, register int *len)
  {
      register int mask = (1 << nbits) - 1;
      register char *p = buf_end;
      static const char low_digits[] = "0123456789abcdef";
      static const char upper_digits[] = "0123456789ABCDEF";
      register const char *digits = (format == 'X') ? upper_digits : low_digits;
  
      do {
  	*--p = digits[num & mask];
  	num >>= nbits;
      }
      while (num);
  
      *len = buf_end - p;
      return (p);
  }
  
  static char *conv_p2_quad(u_widest_int num, register int nbits,
  		     char format, char *buf_end, register int *len)
  {
      register int mask = (1 << nbits) - 1;
      register char *p = buf_end;
      static const char low_digits[] = "0123456789abcdef";
      static const char upper_digits[] = "0123456789ABCDEF";
      register const char *digits = (format == 'X') ? upper_digits : low_digits;
  
      if (num <= ULONG_MAX)
      	return(conv_p2( (u_wide_int)num, nbits, format, buf_end, len));
  
      do {
  	*--p = digits[num & mask];
  	num >>= nbits;
      }
      while (num);
  
      *len = buf_end - p;
      return (p);
  }
  
  
  /*
   * Do format conversion placing the output in buffer
   */
  APR_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff_t *),
      ap_vformatter_buff_t *vbuff, const char *fmt, va_list ap)
  {
      register char *sp;
      register char *bep;
      register int cc = 0;
      register int i;
  
      register char *s = NULL;
      char *q;
      int s_len;
  
      register int min_width = 0;
      int precision = 0;
      enum {
  	LEFT, RIGHT
      } adjust;
      char pad_char;
      char prefix_char;
  
      double fp_num;
      widest_int i_quad = (widest_int) 0;
      u_widest_int ui_quad;
      wide_int i_num = (wide_int) 0;
      u_wide_int ui_num;
  
      char num_buf[NUM_BUF_SIZE];
      char char_buf[2];		/* for printing %% and %<unknown> */
  
      enum var_type_enum {
      	IS_QUAD, IS_LONG, IS_SHORT, IS_INT
      };
      enum var_type_enum var_type = IS_INT;
  
      /*
       * Flag variables
       */
      boolean_e alternate_form;
      boolean_e print_sign;
      boolean_e print_blank;
      boolean_e adjust_precision;
      boolean_e adjust_width;
      bool_int is_negative;
  
      sp = vbuff->curpos;
      bep = vbuff->endpos;
  
      while (*fmt) {
  	if (*fmt != '%') {
  	    INS_CHAR(*fmt, sp, bep, cc);
  	}
  	else {
  	    /*
  	     * Default variable settings
  	     */
  	    adjust = RIGHT;
  	    alternate_form = print_sign = print_blank = NO;
  	    pad_char = ' ';
  	    prefix_char = NUL;
  
  	    fmt++;
  
  	    /*
  	     * Try to avoid checking for flags, width or precision
  	     */
  	    if (!ap_islower(*fmt)) {
  		/*
  		 * Recognize flags: -, #, BLANK, +
  		 */
  		for (;; fmt++) {
  		    if (*fmt == '-')
  			adjust = LEFT;
  		    else if (*fmt == '+')
  			print_sign = YES;
  		    else if (*fmt == '#')
  			alternate_form = YES;
  		    else if (*fmt == ' ')
  			print_blank = YES;
  		    else if (*fmt == '0')
  			pad_char = '0';
  		    else
  			break;
  		}
  
  		/*
  		 * Check if a width was specified
  		 */
  		if (ap_isdigit(*fmt)) {
  		    STR_TO_DEC(fmt, min_width);
  		    adjust_width = YES;
  		}
  		else if (*fmt == '*') {
  		    min_width = va_arg(ap, int);
  		    fmt++;
  		    adjust_width = YES;
  		    if (min_width < 0) {
  			adjust = LEFT;
  			min_width = -min_width;
  		    }
  		}
  		else
  		    adjust_width = NO;
  
  		/*
  		 * Check if a precision was specified
  		 *
  		 * XXX: an unreasonable amount of precision may be specified
  		 * resulting in overflow of num_buf. Currently we
  		 * ignore this possibility.
  		 */
  		if (*fmt == '.') {
  		    adjust_precision = YES;
  		    fmt++;
  		    if (ap_isdigit(*fmt)) {
  			STR_TO_DEC(fmt, precision);
  		    }
  		    else if (*fmt == '*') {
  			precision = va_arg(ap, int);
  			fmt++;
  			if (precision < 0)
  			    precision = 0;
  		    }
  		    else
  			precision = 0;
  		}
  		else
  		    adjust_precision = NO;
  	    }
  	    else
  		adjust_precision = adjust_width = NO;
  
  	    /*
  	     * Modifier check
  	     */
  	    if (*fmt == 'q') {
  		var_type = IS_QUAD;
  		fmt++;
  	    }
  	    else if (*fmt == 'l') {
  		var_type = IS_LONG;
  		fmt++;
  	    }
  	    else if (*fmt == 'h') {
  		var_type = IS_SHORT;
  		fmt++;
  	    }
  	    else {
  		var_type = IS_INT;
  	    }
  
  	    /*
  	     * Argument extraction and printing.
  	     * First we determine the argument type.
  	     * Then, we convert the argument to a string.
  	     * On exit from the switch, s points to the string that
  	     * must be printed, s_len has the length of the string
  	     * The precision requirements, if any, are reflected in s_len.
  	     *
  	     * NOTE: pad_char may be set to '0' because of the 0 flag.
  	     *   It is reset to ' ' by non-numeric formats
  	     */
  	    switch (*fmt) {
  	    case 'u':
  	    	if (var_type == IS_QUAD) {
  		    i_quad = va_arg(ap, u_widest_int);
  		    s = conv_10_quad(i_quad, 1, &is_negative,
  			    &num_buf[NUM_BUF_SIZE], &s_len);
  		}
  		else {
  		    if (var_type == IS_LONG)
  			i_num = (wide_int) va_arg(ap, u_wide_int);
  		    else if (var_type == IS_SHORT)
  			i_num = (wide_int) (unsigned short) va_arg(ap, unsigned int);
  		    else
  			i_num = (wide_int) va_arg(ap, unsigned int);
  		    s = conv_10(i_num, 1, &is_negative,
  			    &num_buf[NUM_BUF_SIZE], &s_len);
  		}
  		FIX_PRECISION(adjust_precision, precision, s, s_len);
  		break;
  
  	    case 'd':
  	    case 'i':
  	    	if (var_type == IS_QUAD) {
  		    i_quad = va_arg(ap, widest_int);
  		    s = conv_10_quad(i_quad, 0, &is_negative,
  			    &num_buf[NUM_BUF_SIZE], &s_len);
  		}
  		else {
  		    if (var_type == IS_LONG)
  			i_num = (wide_int) va_arg(ap, wide_int);
  		    else if (var_type == IS_SHORT)
  			i_num = (wide_int) (short) va_arg(ap, int);
  		    else
  			i_num = (wide_int) va_arg(ap, int);
  		    s = conv_10(i_num, 0, &is_negative,
  			    &num_buf[NUM_BUF_SIZE], &s_len);
  		}
  		FIX_PRECISION(adjust_precision, precision, s, s_len);
  
  		if (is_negative)
  		    prefix_char = '-';
  		else if (print_sign)
  		    prefix_char = '+';
  		else if (print_blank)
  		    prefix_char = ' ';
  		break;
  
  
  	    case 'o':
  		if (var_type == IS_QUAD) {
  		    ui_quad = va_arg(ap, u_widest_int);
  		    s = conv_p2_quad(ui_quad, 3, *fmt,
  			    &num_buf[NUM_BUF_SIZE], &s_len);
  		}
  		else {
  		    if (var_type == IS_LONG)
  			ui_num = (u_wide_int) va_arg(ap, u_wide_int);
  		    else if (var_type == IS_SHORT)
  			ui_num = (u_wide_int) (unsigned short) va_arg(ap, unsigned int);
  		    else
  			ui_num = (u_wide_int) va_arg(ap, unsigned int);
  		    s = conv_p2(ui_num, 3, *fmt,
  			    &num_buf[NUM_BUF_SIZE], &s_len);
  		}
  		FIX_PRECISION(adjust_precision, precision, s, s_len);
  		if (alternate_form && *s != '0') {
  		    *--s = '0';
  		    s_len++;
  		}
  		break;
  
  
  	    case 'x':
  	    case 'X':
  		if (var_type == IS_QUAD) {
  		    ui_quad = va_arg(ap, u_widest_int);
  		    s = conv_p2_quad(ui_quad, 4, *fmt,
  			    &num_buf[NUM_BUF_SIZE], &s_len);
  		}
  		else {
  		    if (var_type == IS_LONG)
  			ui_num = (u_wide_int) va_arg(ap, u_wide_int);
  		    else if (var_type == IS_SHORT)
  			ui_num = (u_wide_int) (unsigned short) va_arg(ap, unsigned int);
  		    else
  			ui_num = (u_wide_int) va_arg(ap, unsigned int);
  		    s = conv_p2(ui_num, 4, *fmt,
  			    &num_buf[NUM_BUF_SIZE], &s_len);
  		}
  		FIX_PRECISION(adjust_precision, precision, s, s_len);
  		if (alternate_form && i_num != 0) {
  		    *--s = *fmt;	/* 'x' or 'X' */
  		    *--s = '0';
  		    s_len += 2;
  		}
  		break;
  
  
  	    case 's':
  		s = va_arg(ap, char *);
  		if (s != NULL) {
  		    s_len = strlen(s);
  		    if (adjust_precision && precision < s_len)
  			s_len = precision;
  		}
  		else {
  		    s = S_NULL;
  		    s_len = S_NULL_LEN;
  		}
  		pad_char = ' ';
  		break;
  
  
  	    case 'f':
  	    case 'e':
  	    case 'E':
  		fp_num = va_arg(ap, double);
  		/*
  		 * * We use &num_buf[ 1 ], so that we have room for the sign
  		 */
  		s = conv_fp(*fmt, fp_num, alternate_form,
  			(adjust_precision == NO) ? FLOAT_DIGITS : precision,
  			    &is_negative, &num_buf[1], &s_len);
  		if (is_negative)
  		    prefix_char = '-';
  		else if (print_sign)
  		    prefix_char = '+';
  		else if (print_blank)
  		    prefix_char = ' ';
  		break;
  
  
  	    case 'g':
  	    case 'G':
  		if (adjust_precision == NO)
  		    precision = FLOAT_DIGITS;
  		else if (precision == 0)
  		    precision = 1;
  		/*
  		 * * We use &num_buf[ 1 ], so that we have room for the sign
  		 */
  		s = ap_gcvt(va_arg(ap, double), precision, &num_buf[1],
  		            alternate_form);
  		if (*s == '-')
  		    prefix_char = *s++;
  		else if (print_sign)
  		    prefix_char = '+';
  		else if (print_blank)
  		    prefix_char = ' ';
  
  		s_len = strlen(s);
  
  		if (alternate_form && (q = strchr(s, '.')) == NULL) {
  		    s[s_len++] = '.';
  		    s[s_len] = '\0'; /* delimit for following strchr() */
  		}
  		if (*fmt == 'G' && (q = strchr(s, 'e')) != NULL)
  		    *q = 'E';
  		break;
  
  
  	    case 'c':
  		char_buf[0] = (char) (va_arg(ap, int));
  		s = &char_buf[0];
  		s_len = 1;
  		pad_char = ' ';
  		break;
  
  
  	    case '%':
  		char_buf[0] = '%';
  		s = &char_buf[0];
  		s_len = 1;
  		pad_char = ' ';
  		break;
  
  
  	    case 'n':
  	    	if (var_type == IS_QUAD)
  		    *(va_arg(ap, widest_int *)) = cc;
  		else if (var_type == IS_LONG)
  		    *(va_arg(ap, long *)) = cc;
  		else if (var_type == IS_SHORT)
  		    *(va_arg(ap, short *)) = cc;
  		else
  		    *(va_arg(ap, int *)) = cc;
  		break;
  
  		/*
  		 * This is where we extend the printf format, with a second
  		 * type specifier
  		 */
  	    case 'p':
  		switch(*++fmt) {
  		    /*
  		     * If the pointer size is equal to or smaller than the size
  		     * of the largest unsigned int, we convert the pointer to a
  		     * hex number, otherwise we print "%p" to indicate that we
  		     * don't handle "%p".
  		     */
  		case 'p':
  #ifdef AP_VOID_P_IS_QUAD
  		    if (sizeof(void *) <= sizeof(u_widest_int)) {
  		    	ui_quad = (u_widest_int) va_arg(ap, void *);
  			s = conv_p2_quad(ui_quad, 4, 'x',
  				&num_buf[NUM_BUF_SIZE], &s_len);
  		    }
  #else
  		    if (sizeof(void *) <= sizeof(u_wide_int)) {
  		    	ui_num = (u_wide_int) va_arg(ap, void *);
  			s = conv_p2(ui_num, 4, 'x',
  				&num_buf[NUM_BUF_SIZE], &s_len);
  		    }
  #endif
  		    else {
  			s = "%p";
  			s_len = 2;
  			prefix_char = NUL;
  		    }
  		    pad_char = ' ';
  		    break;
  
  		    /* print a struct sockaddr_in as a.b.c.d:port */
  		case 'I':
  		    {
  			struct sockaddr_in *si;
  
  			si = va_arg(ap, struct sockaddr_in *);
  			if (si != NULL) {
  			    s = conv_sockaddr_in(si, &num_buf[NUM_BUF_SIZE], &s_len);
  			    if (adjust_precision && precision < s_len)
  				s_len = precision;
  			}
  			else {
  			    s = S_NULL;
  			    s_len = S_NULL_LEN;
  			}
  			pad_char = ' ';
  		    }
  		    break;
  
  		    /* print a struct in_addr as a.b.c.d */
  		case 'A':
  		    {
  			struct in_addr *ia;
  
  			ia = va_arg(ap, struct in_addr *);
  			if (ia != NULL) {
  			    s = conv_in_addr(ia, &num_buf[NUM_BUF_SIZE], &s_len);
  			    if (adjust_precision && precision < s_len)
  				s_len = precision;
  			}
  			else {
  			    s = S_NULL;
  			    s_len = S_NULL_LEN;
  			}
  			pad_char = ' ';
  		    }
  		    break;
  
  		case NUL:
  		    /* if %p ends the string, oh well ignore it */
  		    continue;
  
  		default:
  		    s = "bogus %p";
  		    s_len = 8;
  		    prefix_char = NUL;
  		    break;
  		}
  		break;
  
  	    case NUL:
  		/*
  		 * The last character of the format string was %.
  		 * We ignore it.
  		 */
  		continue;
  
  
  		/*
  		 * The default case is for unrecognized %'s.
  		 * We print %<char> to help the user identify what
  		 * option is not understood.
  		 * This is also useful in case the user wants to pass
  		 * the output of format_converter to another function
  		 * that understands some other %<char> (like syslog).
  		 * Note that we can't point s inside fmt because the
  		 * unknown <char> could be preceded by width etc.
  		 */
  	    default:
  		char_buf[0] = '%';
  		char_buf[1] = *fmt;
  		s = char_buf;
  		s_len = 2;
  		pad_char = ' ';
  		break;
  	    }
  
  	    if (prefix_char != NUL && s != S_NULL && s != char_buf) {
  		*--s = prefix_char;
  		s_len++;
  	    }
  
  	    if (adjust_width && adjust == RIGHT && min_width > s_len) {
  		if (pad_char == '0' && prefix_char != NUL) {
  		    INS_CHAR(*s, sp, bep, cc);
  		    s++;
  		    s_len--;
  		    min_width--;
  		}
  		PAD(min_width, s_len, pad_char);
  	    }
  
  	    /*
  	     * Print the string s. 
  	     */
  	    for (i = s_len; i != 0; i--) {
  		INS_CHAR(*s, sp, bep, cc);
  		s++;
  	    }
  
  	    if (adjust_width && adjust == LEFT && min_width > s_len)
  		PAD(min_width, s_len, pad_char);
  	}
  	fmt++;
      }
      vbuff->curpos = sp;
      return cc;
  }
  
  
  static int snprintf_flush(ap_vformatter_buff_t *vbuff)
  {
      /* if the buffer fills we have to abort immediately, there is no way
       * to "flush" an ap_snprintf... there's nowhere to flush it to.
       */
      return -1;
  }
  
  
  APR_EXPORT(int) ap_snprintf(char *buf, size_t len, const char *format,...)
  {
      int cc;
      va_list ap;
      ap_vformatter_buff_t vbuff;
  
      if (len == 0)
  	return 0;
  
      /* save one byte for nul terminator */
      vbuff.curpos = buf;
      vbuff.endpos = buf + len - 1;
      va_start(ap, format);
      cc = ap_vformatter(snprintf_flush, &vbuff, format, ap);
      va_end(ap);
      *vbuff.curpos = '\0';
      return (cc == -1) ? len : cc;
  }
  
  
  APR_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format,
  			     va_list ap)
  {
      int cc;
      ap_vformatter_buff_t vbuff;
  
      if (len == 0)
  	return 0;
  
      /* save one byte for nul terminator */
      vbuff.curpos = buf;
      vbuff.endpos = buf + len - 1;
      cc = ap_vformatter(snprintf_flush, &vbuff, format, ap);
      *vbuff.curpos = '\0';
      return (cc == -1) ? len : cc;
  }
  
  
  
  1.1                  apache-2.0/src/lib/apr/strings/apr_strings.c
  
  Index: apr_strings.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. 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.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
   * ITS 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.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #include "apr.h"
  #include "apr_strings.h"
  #include "apr_private.h"
  #include "apr_lib.h"
  
  APR_EXPORT(char *) ap_pstrdup(ap_pool_t *a, const char *s)
  {
      char *res;
      size_t len;
  
      if (s == NULL) {
          return NULL;
      }
      len = strlen(s) + 1;
      res = ap_palloc(a, len);
      memcpy(res, s, len);
      return res;
  }
  
  APR_EXPORT(char *) ap_pstrndup(ap_pool_t *a, const char *s, ap_size_t n)
  {
      char *res;
  
      if (s == NULL) {
          return NULL;
      }
      res = ap_palloc(a, n + 1);
      memcpy(res, s, n);
      res[n] = '\0';
      return res;
  }
  
  APR_EXPORT_NONSTD(char *) ap_pstrcat(ap_pool_t *a, ...)
  {
      char *cp, *argp, *res;
  
      /* Pass one --- find length of required string */
  
      ap_size_t len = 0;
      va_list adummy;
  
      va_start(adummy, a);
  
      while ((cp = va_arg(adummy, char *)) != NULL) {
          len += strlen(cp);
      }
  
      va_end(adummy);
  
      /* Allocate the required string */
  
      res = (char *) ap_palloc(a, len + 1);
      cp = res;
      *cp = '\0';
  
      /* Pass two --- copy the argument strings into the result space */
  
      va_start(adummy, a);
  
      while ((argp = va_arg(adummy, char *)) != NULL) {
          strcpy(cp, argp);
          cp += strlen(argp);
      }
  
      va_end(adummy);
  
      /* Return the result string */
  
      return res;
  }
  
  
  
  
  1.1                  apache-2.0/src/lib/apr/strings/apr_strnatcmp.c
  
  Index: apr_strnatcmp.c
  ===================================================================
  /* -*- mode: c; c-file-style: "k&r" -*-
  
    strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
    Copyright (C) 2000 by Martin Pool <mb...@humbug.org.au>
  
    This software is provided 'as-is', without any express or implied
    warranty.  In no event will the authors be held liable for any damages
    arising from the use of this software.
  
    Permission is granted to anyone to use this software for any purpose,
    including commercial applications, and to alter it and redistribute it
    freely, subject to the following restrictions:
  
    1. The origin of this software must not be misrepresented; you must not
       claim that you wrote the original software. If you use this software
       in a product, an acknowledgment in the product documentation would be
       appreciated but is not required.
    2. Altered source versions must be plainly marked as such, and must not be
       misrepresented as being the original software.
    3. This notice may not be removed or altered from any source distribution.
  */
  
  #include <ctype.h>
  #include <string.h>
  #include <assert.h>
  #include <stdio.h>
  
  #include "apr_strnatcmp.h"
  
  #if defined(__GNUC__)
  #  define UNUSED __attribute__((__unused__))
  #else
  #  define UNUSED
  #endif
  
  /* based on "strnatcmp.c,v 1.6 2000/04/20 07:30:11 mbp Exp $" */
  
  static int
  compare_right(char const *a, char const *b)
  {
       int bias = 0;
       
       /* The longest run of digits wins.  That aside, the greatest
  	value wins, but we can't know that it will until we've scanned
  	both numbers to know that they have the same magnitude, so we
  	remember it in BIAS. */
       for (;; a++, b++) {
  	  if (!isdigit(*a)  &&  !isdigit(*b))
  	       return bias;
  	  else if (!isdigit(*a))
  	       return -1;
  	  else if (!isdigit(*b))
  	       return +1;
  	  else if (*a < *b) {
  	       if (!bias)
  		    bias = -1;
  	  } else if (*a > *b) {
  	       if (!bias)
  		    bias = +1;
  	  } else if (!*a  &&  !*b)
  	       return bias;
       }
  
       return 0;
  }
  
  
  static int
  compare_left(char const *a, char const *b)
  {
       /* Compare two left-aligned numbers: the first to have a
          different value wins. */
       for (;; a++, b++) {
  	  if (!isdigit(*a)  &&  !isdigit(*b))
  	       return 0;
  	  else if (!isdigit(*a))
  	       return -1;
  	  else if (!isdigit(*b))
  	       return +1;
  	  else if (*a < *b)
  	       return -1;
  	  else if (*a > *b)
  	       return +1;
       }
  	  
       return 0;
  }
  
  
  static int strnatcmp0(char const *a, char const *b, int fold_case)
  {
       int ai, bi;
       char ca, cb;
       int fractional, result;
       
       assert(a && b);
       ai = bi = 0;
       while (1) {
  	  ca = a[ai]; cb = b[bi];
  
  	  /* skip over leading spaces or zeros */
  	  while (isspace(ca))
  	       ca = a[++ai];
  
  	  while (isspace(cb))
  	       cb = b[++bi];
  
  	  /* process run of digits */
  	  if (isdigit(ca)  &&  isdigit(cb)) {
  	       fractional = (ca == '0' || cb == '0');
  
  	       if (fractional) {
  		    if ((result = compare_left(a+ai, b+bi)) != 0)
  			 return result;
  	       } else {
  		    if ((result = compare_right(a+ai, b+bi)) != 0)
  			 return result;
  	       }
  	  }
  
  	  if (!ca && !cb) {
  	       /* The strings compare the same.  Perhaps the caller
                    will want to call strcmp to break the tie. */
  	       return 0;
  	  }
  
  	  if (fold_case) {
  	       ca = toupper(ca);
  	       cb = toupper(cb);
  	  }
  	  
  	  if (ca < cb)
  	       return -1;
  	  else if (ca > cb)
  	       return +1;
  
  	  ++ai; ++bi;
       }
  }
  
  
  
  int ap_strnatcmp(char const *a, char const *b) {
       return strnatcmp0(a, b, 0);
  }
  
  
  /* Compare, recognizing numeric string and ignoring case. */
  int ap_strnatcasecmp(char const *a, char const *b) {
       return strnatcmp0(a, b, 1);
  }
  
  
  
  1.33      +1 -0      apache-2.0/src/lib/apr/threadproc/unix/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/unix/proc.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- proc.c	2000/06/20 19:36:44	1.32
  +++ proc.c	2000/07/21 19:50:46	1.33
  @@ -53,6 +53,7 @@
    */
   
   #include "threadproc.h"
  +#include "apr_strings.h"
   #include "apr_portable.h"
   
   ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont)
  
  
  
  1.70      +1 -0      apache-2.0/src/main/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_config.c,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- http_config.c	2000/06/28 14:33:31	1.69
  +++ http_config.c	2000/07/21 19:50:46	1.70
  @@ -75,6 +75,7 @@
   
   #include "ap_config.h"
   #include "apr_portable.h"
  +#include "apr_strings.h"
   #include "apr_file_io.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.43      +1 -0      apache-2.0/src/main/http_connection.c
  
  Index: http_connection.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_connection.c,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- http_connection.c	2000/07/17 22:11:12	1.42
  +++ http_connection.c	2000/07/21 19:50:46	1.43
  @@ -58,6 +58,7 @@
   
   #define CORE_PRIVATE
   #include "ap_config.h"
  +#include "apr_strings.h"
   #include "httpd.h"
   #include "http_connection.h"
   #include "http_request.h"
  
  
  
  1.89      +1 -0      apache-2.0/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- http_core.c	2000/07/11 03:48:18	1.88
  +++ http_core.c	2000/07/21 19:50:46	1.89
  @@ -58,6 +58,7 @@
   
   #define CORE_PRIVATE
   #include "ap_config.h"
  +#include "apr_strings.h"
   #include "apr_lib.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.63      +1 -0      apache-2.0/src/main/http_log.c
  
  Index: http_log.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_log.c,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- http_log.c	2000/07/13 16:26:42	1.62
  +++ http_log.c	2000/07/21 19:50:46	1.63
  @@ -67,6 +67,7 @@
   #define CORE_PRIVATE
   #include "apr.h"  /* for ap_signal */
   #include "ap_config.h"
  +#include "apr_strings.h"
   #include "apr_lib.h"
   #include "apr_portable.h"
   #include "httpd.h"
  
  
  
  1.61      +1 -0      apache-2.0/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_main.c,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- http_main.c	2000/07/11 22:12:15	1.60
  +++ http_main.c	2000/07/21 19:50:46	1.61
  @@ -65,6 +65,7 @@
   #include "http_vhost.h"
   #include "util_uri.h" 
   #include "util_ebcdic.h"
  +#include "apr_strings.h"
   #include "apr_getopt.h"
   #include "ap_mpm.h"
   
  
  
  
  1.97      +1 -0      apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- http_protocol.c	2000/07/13 16:26:42	1.96
  +++ http_protocol.c	2000/07/21 19:50:47	1.97
  @@ -65,6 +65,7 @@
   
   #define CORE_PRIVATE
   #include "ap_config.h"
  +#include "apr_strings.h"
   #include "httpd.h"
   #include "http_config.h"
   #include "http_core.h"
  
  
  
  1.36      +1 -0      apache-2.0/src/main/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_request.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- http_request.c	2000/06/24 17:33:57	1.35
  +++ http_request.c	2000/07/21 19:50:47	1.36
  @@ -76,6 +76,7 @@
   #include "http_log.h"
   #include "http_main.h"
   #include "util_charset.h"
  +#include "apr_strings.h"
   #include "apr_file_io.h"
   #include "apr_fnmatch.h"
   
  
  
  
  1.24      +1 -0      apache-2.0/src/main/http_vhost.c
  
  Index: http_vhost.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_vhost.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- http_vhost.c	2000/06/28 14:33:33	1.23
  +++ http_vhost.c	2000/07/21 19:50:47	1.24
  @@ -69,6 +69,7 @@
   #include "http_vhost.h"
   #include "http_protocol.h"
   #include "http_core.h"
  +#include "apr_strings.h"
   
   #ifdef HAVE_ARPA_INET_H
   #include <arpa/inet.h>
  
  
  
  1.29      +1 -0      apache-2.0/src/main/listen.c
  
  Index: listen.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/listen.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- listen.c	2000/07/16 07:12:41	1.28
  +++ listen.c	2000/07/21 19:50:47	1.29
  @@ -63,6 +63,7 @@
   #include "httpd.h"
   #include "http_config.h"
   #include "ap_listen.h"
  +#include "apr_strings.h"
   #include "http_log.h"
   #include "mpm.h"
   #ifdef HAVE_STRING_H
  
  
  
  1.63      +1 -0      apache-2.0/src/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util.c,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- util.c	2000/07/17 22:11:13	1.62
  +++ util.c	2000/07/21 19:50:47	1.63
  @@ -73,6 +73,7 @@
   
   #include "ap_config.h"
   #include "ap_base64.h"
  +#include "apr_strings.h"
   #include "httpd.h"
   #include "http_main.h"
   #include "http_log.h"
  
  
  
  1.16      +1 -0      apache-2.0/src/main/util_md5.c
  
  Index: util_md5.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_md5.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- util_md5.c	2000/06/01 22:52:50	1.15
  +++ util_md5.c	2000/07/21 19:50:47	1.16
  @@ -87,6 +87,7 @@
   
   #include "ap_config.h"
   #include "apr_portable.h"
  +#include "apr_strings.h"
   #include "httpd.h"
   #include "util_md5.h"
   #include "util_ebcdic.h"
  
  
  
  1.37      +1 -0      apache-2.0/src/main/util_script.c
  
  Index: util_script.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_script.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- util_script.c	2000/07/05 21:06:23	1.36
  +++ util_script.c	2000/07/21 19:50:47	1.37
  @@ -58,6 +58,7 @@
   
   #define CORE_PRIVATE
   #include "ap_config.h"
  +#include "apr_strings.h"
   #include "httpd.h"
   #include "http_config.h"
   #include "http_main.h"
  
  
  
  1.17      +1 -0      apache-2.0/src/main/util_uri.c
  
  Index: util_uri.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_uri.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- util_uri.c	2000/07/17 22:11:14	1.16
  +++ util_uri.c	2000/07/21 19:50:47	1.17
  @@ -62,6 +62,7 @@
    */
   
   #include "ap_config.h"
  +#include "apr_strings.h"
   #include "httpd.h"
   #include "http_log.h"
   #include "util_uri.h"
  
  
  
  1.8       +1 -0      apache-2.0/src/main/util_xml.c
  
  Index: util_xml.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_xml.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- util_xml.c	2000/07/11 00:06:21	1.7
  +++ util_xml.c	2000/07/21 19:50:47	1.8
  @@ -64,6 +64,7 @@
   #include "http_protocol.h"
   #include "http_log.h"
   #include "http_core.h"
  +#include "apr_strings.h"
   
   #include "util_xml.h"
   
  
  
  
  1.11      +1 -0      apache-2.0/src/modules/mpm/beos/beos.c
  
  Index: beos.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/beos/beos.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- beos.c	2000/07/11 22:12:16	1.10
  +++ beos.c	2000/07/21 19:50:50	1.11
  @@ -66,6 +66,7 @@
    
   #define CORE_PRIVATE 
    
  +#include "apr_strings.h"
   #include "apr_portable.h"
   #include "httpd.h" 
   #include "http_main.h" 
  
  
  
  1.114     +1 -0      apache-2.0/src/modules/mpm/dexter/dexter.c
  
  Index: dexter.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v
  retrieving revision 1.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- dexter.c	2000/07/11 22:12:16	1.113
  +++ dexter.c	2000/07/21 19:50:51	1.114
  @@ -60,6 +60,7 @@
    
   #include "ap_config.h"
   #include "apr_portable.h"
  +#include "apr_strings.h"
   #include "apr_file_io.h"
   #include "httpd.h" 
   #include "http_main.h" 
  
  
  
  1.16      +1 -0      apache-2.0/src/modules/mpm/mpmt/mpmt.c
  
  Index: mpmt.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt/mpmt.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- mpmt.c	2000/07/19 17:51:07	1.15
  +++ mpmt.c	2000/07/21 19:50:51	1.16
  @@ -59,6 +59,7 @@
   #define CORE_PRIVATE 
    
   #include "apr_portable.h"
  +#include "apr_strings.h"
   #include "apr_file_io.h"
   #include "apr_thread_proc.h"
   #include "ap_config.h"
  
  
  
  1.41      +1 -0      apache-2.0/src/modules/mpm/mpmt_beos/mpmt_beos.c
  
  Index: mpmt_beos.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_beos/mpmt_beos.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- mpmt_beos.c	2000/07/11 22:12:17	1.40
  +++ mpmt_beos.c	2000/07/21 19:50:52	1.41
  @@ -62,6 +62,7 @@
    
   #define CORE_PRIVATE 
    
  +#include "apr_strings.h"
   #include "apr_portable.h"
   #include "httpd.h" 
   #include "http_main.h" 
  
  
  
  1.109     +1 -0      apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c
  
  Index: mpmt_pthread.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v
  retrieving revision 1.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- mpmt_pthread.c	2000/07/17 22:11:23	1.108
  +++ mpmt_pthread.c	2000/07/21 19:50:52	1.109
  @@ -59,6 +59,7 @@
   #define CORE_PRIVATE 
    
   #include "apr_portable.h"
  +#include "apr_strings.h"
   #include "apr_file_io.h"
   #include "apr_thread_proc.h"
   #include "ap_config.h"
  
  
  
  1.120     +1 -0      apache-2.0/src/modules/mpm/prefork/prefork.c
  
  Index: prefork.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v
  retrieving revision 1.119
  retrieving revision 1.120
  diff -u -r1.119 -r1.120
  --- prefork.c	2000/07/19 17:42:56	1.119
  +++ prefork.c	2000/07/21 19:50:52	1.120
  @@ -89,6 +89,7 @@
   
   #include "ap_config.h"
   #include "apr_portable.h"
  +#include "apr_strings.h"
   #include "apr_thread_proc.h"
   #include "httpd.h"
   #include "mpm_default.h"
  
  
  
  1.17      +1 -0      apache-2.0/src/modules/standard/mod_access.c
  
  Index: mod_access.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_access.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- mod_access.c	2000/06/28 14:33:38	1.16
  +++ mod_access.c	2000/07/21 19:50:53	1.17
  @@ -63,6 +63,7 @@
    * 
    */
   
  +#include "apr_strings.h"
   #include "apr_network_io.h"
   #include "ap_config.h"
   #include "httpd.h"
  
  
  
  1.13      +1 -0      apache-2.0/src/modules/standard/mod_actions.c
  
  Index: mod_actions.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_actions.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- mod_actions.c	2000/06/24 17:34:00	1.12
  +++ mod_actions.c	2000/07/21 19:50:53	1.13
  @@ -78,6 +78,7 @@
    * URI includes query information (stuff after a ?-mark).
    */
   
  +#include "apr_strings.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.15      +1 -0      apache-2.0/src/modules/standard/mod_alias.c
  
  Index: mod_alias.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_alias.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- mod_alias.c	2000/06/28 14:33:38	1.14
  +++ mod_alias.c	2000/07/21 19:50:53	1.15
  @@ -64,6 +64,7 @@
    * 
    */
   
  +#include "apr_strings.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.24      +1 -0      apache-2.0/src/modules/standard/mod_asis.c
  
  Index: mod_asis.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_asis.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- mod_asis.c	2000/07/10 21:49:22	1.23
  +++ mod_asis.c	2000/07/21 19:50:53	1.24
  @@ -56,6 +56,7 @@
    * University of Illinois, Urbana-Champaign.
    */
   
  +#include "apr_strings.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.22      +1 -0      apache-2.0/src/modules/standard/mod_auth.c
  
  Index: mod_auth.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_auth.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- mod_auth.c	2000/06/24 17:34:01	1.21
  +++ mod_auth.c	2000/07/21 19:50:53	1.22
  @@ -71,6 +71,7 @@
    */
   
   #include "ap_config.h"
  +#include "apr_strings.h"
   #include "apr_md5.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.38      +1 -0      apache-2.0/src/modules/standard/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_autoindex.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- mod_autoindex.c	2000/06/28 14:33:38	1.37
  +++ mod_autoindex.c	2000/07/21 19:50:53	1.38
  @@ -66,6 +66,7 @@
    *
    * Version sort added by Martin Pool <mb...@humbug.org.au>. */
   
  +#include "apr_strings.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.54      +1 -0      apache-2.0/src/modules/standard/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cgi.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- mod_cgi.c	2000/06/28 14:33:38	1.53
  +++ mod_cgi.c	2000/07/21 19:50:53	1.54
  @@ -71,6 +71,7 @@
   
   #define CORE_PRIVATE
   
  +#include "apr_strings.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.29      +1 -0      apache-2.0/src/modules/standard/mod_cgid.c
  
  Index: mod_cgid.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cgid.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- mod_cgid.c	2000/07/19 18:04:24	1.28
  +++ mod_cgid.c	2000/07/21 19:50:53	1.29
  @@ -74,6 +74,7 @@
   #define CORE_PRIVATE 
   
   #include "apr_lib.h"
  +#include "apr_strings.h"
   #include "apr_general.h"
   #include "apr_file_io.h"
   #include "apr_portable.h"
  
  
  
  1.16      +1 -0      apache-2.0/src/modules/standard/mod_dir.c
  
  Index: mod_dir.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_dir.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- mod_dir.c	2000/06/20 20:42:06	1.15
  +++ mod_dir.c	2000/07/21 19:50:53	1.16
  @@ -60,6 +60,7 @@
    * mod_dir.c: handle default index files, and trailing-/ redirects
    */
   
  +#include "apr_strings.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.13      +1 -0      apache-2.0/src/modules/standard/mod_env.c
  
  Index: mod_env.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_env.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- mod_env.c	2000/06/17 16:53:50	1.12
  +++ mod_env.c	2000/07/21 19:50:53	1.13
  @@ -99,6 +99,7 @@
    *       *** older versions of the module.                        ***
    */
   
  +#include "apr_strings.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.19      +1 -0      apache-2.0/src/modules/standard/mod_imap.c
  
  Index: mod_imap.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_imap.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- mod_imap.c	2000/06/28 14:33:40	1.18
  +++ mod_imap.c	2000/07/21 19:50:54	1.19
  @@ -92,6 +92,7 @@
    * Mark Cox, mark@ukweb.com, Allow relative URLs even when no base specified
    */
   
  +#include "apr_strings.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.46      +1 -0      apache-2.0/src/modules/standard/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_include.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- mod_include.c	2000/07/17 22:11:32	1.45
  +++ mod_include.c	2000/07/21 19:50:54	1.46
  @@ -87,6 +87,7 @@
   #endif
   #include "modules/perl/mod_perl.h"
   #else
  +#include "apr_strings.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.29      +1 -0      apache-2.0/src/modules/standard/mod_log_config.c
  
  Index: mod_log_config.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_log_config.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- mod_log_config.c	2000/07/05 18:01:52	1.28
  +++ mod_log_config.c	2000/07/21 19:50:54	1.29
  @@ -170,6 +170,7 @@
   
   #define DEFAULT_LOG_FORMAT "%h %l %u %t \"%r\" %>s %b"
   
  +#include "apr_strings.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.21      +1 -0      apache-2.0/src/modules/standard/mod_mime.c
  
  Index: mod_mime.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_mime.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- mod_mime.c	2000/06/19 18:11:47	1.20
  +++ mod_mime.c	2000/07/21 19:50:54	1.21
  @@ -65,6 +65,7 @@
   
   #define MIME_PRIVATE
   
  +#include "apr_strings.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.35      +1 -0      apache-2.0/src/modules/standard/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_negotiation.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- mod_negotiation.c	2000/06/28 14:33:41	1.34
  +++ mod_negotiation.c	2000/07/21 19:50:54	1.35
  @@ -64,6 +64,7 @@
    */
   
   #include "ap_config.h"
  +#include "apr_strings.h"
   #include "apr_file_io.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.16      +1 -0      apache-2.0/src/modules/standard/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_setenvif.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- mod_setenvif.c	2000/06/28 14:33:42	1.15
  +++ mod_setenvif.c	2000/07/21 19:50:54	1.16
  @@ -115,6 +115,7 @@
    *    SetEnvIf remote_addr (127.0.0.1|192.168.10.) LOCAL
    */
   
  +#include "apr_strings.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.16      +1 -0      apache-2.0/src/modules/standard/mod_userdir.c
  
  Index: mod_userdir.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_userdir.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- mod_userdir.c	2000/06/28 14:33:42	1.15
  +++ mod_userdir.c	2000/07/21 19:50:54	1.16
  @@ -91,6 +91,7 @@
    * disabled, except those explicitly turned on with the "enabled" keyword.
    */
   
  +#include "apr_strings.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  
  
  
  1.19      +1 -0      apache-2.0/src/support/htpasswd.c
  
  Index: htpasswd.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/support/htpasswd.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- htpasswd.c	2000/06/28 14:33:48	1.18
  +++ htpasswd.c	2000/07/21 19:50:58	1.19
  @@ -79,6 +79,7 @@
    *  6: Failure; username contains illegal or reserved characters
    */
   
  +#include "apr_strings.h"
   #include "apr_lib.h"
   #include "apr_errno.h"
   #include "ap_config.h"