Date: Wed, 1 Jun 2005 11:50:05 GMT From: Giorgos Keramidas <keramida@freebsd.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/81625: "sort by size" option for ls(1) Message-ID: <200506011150.j51Bo5dl051224@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/81625; it has been noted by GNATS.
From: Giorgos Keramidas <keramida@freebsd.org>
To: Dima Dorfman <dd@freebsd.org>
Cc: mplekos@physics.upatras.gr, FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/81625: "sort by size" option for ls(1)
Date: Wed, 1 Jun 2005 14:40:14 +0300
On 2005-06-01 11:25, Dima Dorfman <dd@freebsd.org> wrote:
> Giorgos Keramidas <keramida@FreeBSD.org> wrote:
> > >Description:
> >
> > Kostas Blekos <mplekos@physics.upatras.gr> has mailed me with a patch
> > to ls(1) that allows sorting the output files by size:
>
> Cool, looks like a nice improvement. Some minor comments below. Part
> of the man page update seems to be missing, and I want to change the
> default polarity, but the rest are just minor style nits.
>
> > The -S option is not exactly optimal, but there are so many option
> > letters that are taken by existing ls(1) features that there isn't
> > much of a choise, unless we modify ls to use something like -o for
> > picking a selection order:
>
> -S is okay. OpenBSD and NetBSD use it for the same thing, except that
> their default is to sort the largest files first.
>
> -S Sort by size, largest file first.
>
> Can we change the patch to do that? I'm not sure why they picked
> descending order, but compatibility would be good here.
Agreed.
> > +
> > +int
> > +sizecmp(const FTSENT *a, const FTSENT *b)
> > +{
> > + if (b->fts_statp->st_size > a->fts_statp->st_size)
> > + return (-1);
>
> Style nit: Please add a blank line above the if. If a function has no
> local variables, there should still be a blank line after the brace.
> (See the usage() example in style(9).)
I know. I just patched a local bin/ls and tried that it all works, so
style changes like those you mentioned are perfectly fine :-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200506011150.j51Bo5dl051224>
