You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2002/02/06 16:53:38 UTC

cvs commit: apache-1.3/src/modules/standard mod_autoindex.c

coar        02/02/06 07:53:37

  Modified:    src      CHANGES
               src/modules/standard mod_autoindex.c
  Log:
  Add IgnoreCase keyword for case-insensitve directory listing
  
  Revision  Changes    Path
  1.1769    +8 -2      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1768
  retrieving revision 1.1769
  diff -u -u -r1.1768 -r1.1769
  --- CHANGES	4 Feb 2002 22:30:20 -0000	1.1768
  +++ CHANGES	6 Feb 2002 15:53:36 -0000	1.1769
  @@ -1,8 +1,14 @@
   Changes with Apache 1.3.24
   
  +  *) Add 'IgnoreCase' keyword to the DirectoryIndex directive;
  +     if active, upper- and lower-case letters are insignificant
  +     in ordering.  In other words, all A* and a* files will be
  +     listed together, rather than the a* ones after all the [A-Z]*
  +     ones.  [Tullio Andreatta <tu...@logicom.it>]
  +
     *) NetWare: Implemented the real ap_os_case_canonical_filename()
  -      function that retrieves the accurately cased path and file
  -      name from the file system. [Brad Nicholes bnicholes@novell.com]
  +     function that retrieves the accurately cased path and file
  +     name from the file system. [Brad Nicholes bnicholes@novell.com]
   
     *) Fix the longstanding bug that errors (returned by src/Configure)
        would not be noticed by the top level configure script.
  
  
  
  1.122     +26 -1     apache-1.3/src/modules/standard/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v
  retrieving revision 1.121
  retrieving revision 1.122
  diff -u -u -r1.121 -r1.122
  --- mod_autoindex.c	17 Nov 2001 03:27:09 -0000	1.121
  +++ mod_autoindex.c	6 Feb 2002 15:53:37 -0000	1.122
  @@ -98,6 +98,7 @@
   #define NO_OPTIONS 256
   #define FOLDERS_FIRST 512
   #define TRACK_MODIFIED 1024
  +#define SORT_NOCASE 2048
   
   #define K_PAD 1
   #define K_NOPAD 0
  @@ -411,6 +412,9 @@
   	else if (!strcasecmp(w, "TrackModified")) {
               option = TRACK_MODIFIED;
   	}
  +	else if (!strcasecmp(w, "IgnoreCase")) {
  +            option = SORT_NOCASE;
  +	}
           else if (!strcasecmp(w, "None")) {
   	    if (action != '\0') {
   		return "Cannot combine '+' or '-' with 'None' keyword";
  @@ -732,6 +736,7 @@
       int ascending;
       int isdir;
       int checkdir;
  +    int ignorecase;
       char key;
   };
   
  @@ -1222,6 +1227,7 @@
        * rather than CPU.
        */
       p->checkdir = ((d->opts & FOLDERS_FIRST) != 0);
  +    p->ignorecase = ((d->opts & SORT_NOCASE) != 0);
       p->key = ap_toupper(keyid);
       p->ascending = (ap_toupper(direction) == D_ASCENDING);
   
  @@ -1536,6 +1542,7 @@
       struct ent *c1;
       struct ent *c2;
       int result = 0;
  +    int ignorecase;
   
       /*
        * First, see if either of the entries is for the parent directory.
  @@ -1592,7 +1599,25 @@
           }
           break;
       }
  -    return strcmp(c1->name, c2->name);
  +
  +    ignorecase = c1->ignorecase;
  +    if (ignorecase) {
  +        result = strcasecmp(c1->name, c2->name);
  +        if (result == 0) {
  +            /*
  +             * They're identical when treated case-insensitively, so
  +             * pretend they weren't and let strcmp() put them in a
  +             * deterministic order.  This means that 'ABC' and 'abc'
  +             * will always appear in the same order, rather than
  +             * unpredictably 'ABC abc' or 'abc ABC'.
  +             */
  +            ignorecase = 0;
  +        }
  +    }
  +    if (! ignorecase) {
  +        result = strcmp(c1->name, c2->name);
  +    }
  +    return result;
   }