This got sent to me privately a long time ago, but got
lost in the maze of twisty little passages that is my mail.
It's against 1.3, but if approved I'll bring it forward to
2.0.  I've reworked the original patch from Tullio Andreatta
to apply against HEAD.

The patch adds the IgnoreCase keyword to the IndexOptions directive.
If active, directory listings are displayed case-insensitively.
On systems with case-aware/case-sensitive filesystems, this would
change

o Abc
o Bcd
o Xyz
o abc
o bcd
o xyz

to

o Abc
o abc
o Bcd
o bcd
o Xyz
o xyz

which can be a lot easier for humans to scan when looking for
something specific.

Index: src/modules/standard/mod_autoindex.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v
retrieving revision 1.121
diff -u -r1.121 mod_autoindex.c
--- src/modules/standard/mod_autoindex.c        17 Nov 2001 03:27:09 -0000      1.121
+++ src/modules/standard/mod_autoindex.c        4 Feb 2002 18:08:56 -0000
@@ -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);
 
@@ -1592,7 +1598,14 @@
         }
         break;
     }
-    return strcmp(c1->name, c2->name);
+
+    if (c1->ignorecase) {
+        result = strcasecmp(c1->name, c2->name);
+    }
+    else {
+        result = strcmp(c1->name, c2->name);
+    }
+    return result;
 }
 
 
-- 
#ken    P-)}

Ken Coar, Sanagendamgagwedweinini  http://Golux.Com/coar/
Author, developer, opinionist      http://Apache-Server.Com/

"Millenium hand and shrimp!"

Reply via email to