You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rodent of Unusual Size <co...@Apache.Org> on 1998/12/29 18:56:15 UTC

[PATCH] Default ordering for FancyIndexed directories

PR#1699 points out that even though 1.3 provided a way
to sort autoindexed listings, there's no way to specify a
default ordering.  The attached is a first pass at an
attempt to address this.  I've had it lying around for
a while and thought I'd throw it out for consideration.
It adds an IndexOrderDefault directive, with values like
'ascending name' or 'descending size'.

It's pretty simple; unless someone detects a bogosity maybe
it can close another PR for 1.3.4.
-- 
#ken	P-)}

Ken Coar                    <http://Web.Golux.Com/coar/>
Apache Group member         <http://www.apache.org/>
"Apache Server for Dummies" <http://Web.Golux.Com/coar/ASFD/>

Re: [PATCH] Default ordering for FancyIndexed directories

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Martin Kraemer wrote:
> 
> While I'm +1 on concept for this new directive (one of my clients already
> asked for it), this initialisation isn't accepted by some of the compilers
> I have at hand here.

Changed to a run-time ap_cpystrn() call.

> > +    if (d_cfg->default_order == NULL) {
> > +     d_cfg->default_order = ap_palloc(cmd->pool, 5);
> > +     d_cfg->default_order[4] = '\0';
> > +    }
> Why 5? temp[] is only 4 bytes (including nil)!

A twitch from the original rough draft, when I was thinking
the r->args string included the leading '?'.  D'oh!  Fixed.

> > +    strcpy(d_cfg->default_order, temp);
> > +    return NULL;
> > +}
> You probably avoided ap_cpystrn() because the size is known
> beforehand. Nevertheless....

Fixed..  These were minor enough that I'm not going to waste
bandwidth reposting the updated patch.
-- 
#ken	P-)}

Ken Coar                    <http://Web.Golux.Com/coar/>
Apache Group member         <http://www.apache.org/>
"Apache Server for Dummies" <http://Web.Golux.Com/coar/ASFD/>

Re: [PATCH] Default ordering for FancyIndexed directories

Posted by Martin Kraemer <ma...@mch.sni.de>.
> +{
> +    char temp[4] = {'x', '=', 'x', '\0'};

While I'm +1 on concept for this new directive (one of my clients already
asked for it), this initialisation isn't accepted by some of the compilers
I have at hand here. Can it be changed to either char *temp = "?=?", or
initialized in code (ap_cpystrn(temp,"?=?", sizeof temp)), or to
a static array (threads beware!)?

Sorry for being so conservative ;-)

> +    if (d_cfg->default_order == NULL) {
> +	d_cfg->default_order = ap_palloc(cmd->pool, 5);
> +	d_cfg->default_order[4] = '\0';
> +    }
Why 5? temp[] is only 4 bytes (including nil)!

> +    strcpy(d_cfg->default_order, temp);
> +    return NULL;
> +}
You probably avoided ap_cpystrn() because the size is known
beforehand. Nevertheless....
The rest looks good.

And a happy new year to everyone!

    Martin
-- 
<Ma...@Mch.SNI.De>      |        Siemens Information and
Phone: +49-89-636-46021          |        Communication  Products
FAX:   +49-89-636-47816          |        81730  Munich,  Germany