wrowe       00/10/12 12:45:58

  Modified:    src/main util.c
               src/include httpd.h
  Log:
    Modify ap_make_dirstr_prefix, platforms with HAVE_DRIVE_LETTERS or NETWARE
    can request 0 elements, returning the '/' root.
    [William Rowe, Tim Costello]  from 1.3, with documentation
  
  Revision  Changes    Path
  1.71      +9 -1      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.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- util.c    2000/10/09 22:57:51     1.70
  +++ util.c    2000/10/12 19:45:55     1.71
  @@ -529,7 +529,7 @@
   
       s = d = name;
   
  -#ifdef WIN32
  +#ifdef HAVE_UNC_PATHS
       /* Check for UNC names.  Leave leading two slashes. */
       if (s[0] == '/' && s[1] == '/')
           *d++ = *s++;
  @@ -563,6 +563,14 @@
    */
   API_EXPORT(char *) ap_make_dirstr_prefix(char *d, const char *s, int n)
   {
  +#if defined(HAVE_DRIVE_LETTERS) || defined(NETWARE)
  +    if (!n) {
  +        *d = '/';
  +        *++d = '\0';
  +        return (d);
  +    }
  +#endif /* def HAVE_DRIVE_LETTERS || NETWARE */
  +
       for (;;) {
        if (*s == '\0' || (*s == '/' && (--n) == 0)) {
            *d = '/';
  
  
  
  1.100     +5 -2      apache-2.0/src/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/httpd.h,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- httpd.h   2000/10/12 16:35:38     1.99
  +++ httpd.h   2000/10/12 19:45:56     1.100
  @@ -1323,13 +1323,16 @@
    */
   API_EXPORT(int) ap_count_dirs(const char *path);
   /**
  - * copy at most n leading directories of s into d d should be at least as 
  - * large as s plus 1 extra byte assumes n > 0
  + * Copy at most n leading directories of s into d d should be at least as 
  + * large as s plus 1 extra byte
    * @param d The location to copy to
    * @param s The location to copy from
    * @param n The number of directories to copy
    * @return value is the ever useful pointer to the trailing \0 of d
    * @deffunc char *ap_make_dirstr_prefix(char *d, const char *s, int n)
  + * @tip on platforms with drive letters, n = 0 returns the "/" root, 
  + * whereas n = 1 returns the "d:/" root.  On all other platforms, n = 0
  + * returns the empty string.
    */
   API_EXPORT(char *) ap_make_dirstr_prefix(char *d, const char *s, int n);
   /**
  
  
  

Reply via email to