--- mod_autoindex.c.orig 2004-02-20 12:37:40.000000000 -0800 +++ mod_autoindex.c 2005-03-18 13:09:13.000000000 -0800 @@ -56,6 +56,7 @@ #define FOLDERS_FIRST 512 #define TRACK_MODIFIED 1024 #define SORT_NOCASE 2048 +#define FOLDERS_LAST 4096 #define K_PAD 1 #define K_NOPAD 0 @@ -366,6 +367,9 @@ else if (!strcasecmp(w, "FoldersFirst")) { option = FOLDERS_FIRST; } + else if (!strcasecmp(w, "FoldersLast")) { + option = FOLDERS_LAST; + } else if (!strcasecmp(w, "TrackModified")) { option = TRACK_MODIFIED; } @@ -693,6 +697,7 @@ int ascending; int isdir; int checkdir; + int checkfile; int ignorecase; char key; }; @@ -1230,6 +1235,7 @@ * rather than CPU. */ p->checkdir = ((d->opts & FOLDERS_FIRST) != 0); + p->checkfile = ((d->opts & FOLDERS_LAST) != 0); p->ignorecase = ((d->opts & SORT_NOCASE) != 0); p->key = ap_toupper(keyid); p->ascending = (ap_toupper(direction) == D_ASCENDING); @@ -1566,6 +1572,11 @@ return (*e1)->isdir ? -1 : 1; } } + else if ((*e1)->checkfile) { + if ((*e1)->isdir != (*e2)->isdir) { + return (*e1)->isdir ? 1 : -1; + } + } /* * All of our comparisons will be of the c1 entry against the c2 one, * so assign them appropriately to take care of the ordering.