httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@covalent.net>
Subject Re: [PATCH] Caseless sorting for mod_autoindex
Date Mon, 04 Feb 2002 18:59:23 GMT
++1 for 2.0 [just saw such a complaint this week.]

-0 for 1.3

Forewarned that

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

is equally possible with this patch, it doesn't sort by case at all.

When you look at 2.0, you will notice most of these cosmetics can be
controlled by the query string.  A C=0/C=1[default] would be nice here :)

Bill

----- Original Message ----- 
From: "Rodent of Unusual Size" <Ken.Coar@Golux.Com>
To: "Apache Developers" <dev@httpd.Apache.Org>
Sent: Monday, February 04, 2002 12:56 PM
Subject: [PATCH] Caseless sorting for mod_autoindex


> 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!"
> 



Mime
View raw message