Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 2003 12:05:17 +0200
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        hackers@freebsd.org
Subject:   ls patch to sort directories first
Message-ID:  <258538703.1063886717@sauron.in.mat.cc>

next in thread | raw e-mail | index | archive | help
--==========394B21F250FB8DDEF098==========
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

a few weeks ago, I had a coworker which wanted to ls and have the
directories listed first...
He ended up with a bash function :

lx() {
        \ls -FGhl "$@" | grep ^d | cat;
        \ls -FGhl "$@" | grep -v '^d\|^t' | cat;
}

I though better of it and cooked up a patch for ls :
<http://people.freebsd.org/~mat/current-ls-D.diff>;
<http://people.freebsd.org/~mat/stable-ls-D.diff>;

Both do work well, I don't know if it could be included or not, because I
don't really know what's in POSIX.1 and if we're permitted extensions...

For those who will wonder why I used the FTSENT struct and not the stat
struct within it, it's because the stat struct did not seem to be filled
(and I just could not get it to be filled).

Suggestions mostly welcomed :)

-- 
Mathieu Arnold
--==========394B21F250FB8DDEF098==========
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (MingW32)

iD8DBQE/aYNdqYYpzGz/vmcRAq4SAJ4mQK3C9SbslwzK5Y1kbKxkdjMPqQCgmEVP
anO2ep1uP3lMX6sOaKwBn+Y=
=K7Mz
-----END PGP SIGNATURE-----

--==========394B21F250FB8DDEF098==========--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?258538703.1063886717>