]> granicus.if.org Git - apache/commitdiff
A more thorough example is appropriate. Also simplify the behavior and
authorWilliam A. Rowe Jr <wrowe@apache.org>
Mon, 23 Oct 2000 16:58:21 +0000 (16:58 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Mon, 23 Oct 2000 16:58:21 +0000 (16:58 +0000)
  always return root (/) if n < 1, which is no worse than returning elems
  if n > elems.

PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86717 13f79535-47bb-0310-9956-ffa450edef68

server/util.c

index a3aab61b2d500c46a0816f7ac77c02c798ff3f6a..3eccf5ed9dc2fd114230f9758234b1997d882ffd 100644 (file)
@@ -564,20 +564,25 @@ AP_DECLARE(void) ap_no2slash(char *name)
  * *** See also directory_walk in src/main/http_request.c
 
  * examples:
+ *    /a/b, 0  ==> /  (true for all platforms)
  *    /a/b, 1  ==> /
  *    /a/b, 2  ==> /a/
  *    /a/b, 3  ==> /a/b/
  *    /a/b, 4  ==> /a/b/
+ *
+ *    c:/a/b 0 ==> /
+ *    c:/a/b 1 ==> c:/
+ *    c:/a/b 2 ==> c:/a/
+ *    c:/a/b 3 ==> c:/a/b
+ *    c:/a/b 4 ==> c:/a/b
  */
 AP_DECLARE(char *) ap_make_dirstr_prefix(char *d, const char *s, int n)
 {
-#if defined(HAVE_DRIVE_LETTERS) || defined(NETWARE)
-    if (!n) {
+    if (n < 1) {
         *d = '/';
         *++d = '\0';
         return (d);
     }
-#endif /* def HAVE_DRIVE_LETTERS || NETWARE */
 
     for (;;) {
        if (*s == '\0' || (*s == '/' && (--n) == 0)) {