From owner-freebsd-bugs@FreeBSD.ORG Wed Jun 1 11:50:06 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 004D716A41C for ; Wed, 1 Jun 2005 11:50:05 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C89E143D48 for ; Wed, 1 Jun 2005 11:50:05 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j51Bo5X8051226 for ; Wed, 1 Jun 2005 11:50:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j51Bo5dl051224; Wed, 1 Jun 2005 11:50:05 GMT (envelope-from gnats) Date: Wed, 1 Jun 2005 11:50:05 GMT Message-Id: <200506011150.j51Bo5dl051224@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Giorgos Keramidas Cc: Subject: Re: bin/81625: "sort by size" option for ls(1) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Giorgos Keramidas List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2005 11:50:06 -0000 The following reply was made to PR bin/81625; it has been noted by GNATS. From: Giorgos Keramidas To: Dima Dorfman 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 wrote: > Giorgos Keramidas wrote: > > >Description: > > > > Kostas Blekos 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 :-)