From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 18 03:05:28 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5BDBA16A4B3 for ; Thu, 18 Sep 2003 03:05:28 -0700 (PDT) Received: from mx3.absolight.com (mx3.absolight.net [212.43.217.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id 66A4543FE1 for ; Thu, 18 Sep 2003 03:05:27 -0700 (PDT) (envelope-from mat@FreeBSD.org) Received: by mx3.absolight.com (Postfix, from userid 1007) id 2C4D42A3D; Thu, 18 Sep 2003 12:05:26 +0200 (CEST) X-Original-To: hackers@freebsd.org Received: from sauron.in.mat.cc (sauron.in.mat.cc [212.43.217.122]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx3.absolight.com (Postfix) with ESMTP id 33ABB2A12 for ; Thu, 18 Sep 2003 12:05:25 +0200 (CEST) Date: Thu, 18 Sep 2003 12:05:17 +0200 From: Mathieu Arnold To: hackers@freebsd.org Message-ID: <258538703.1063886717@sauron.in.mat.cc> X-Mailer: Mulberry/3.1.0b7 (Win32) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="==========394B21F250FB8DDEF098==========" Subject: ls patch to sort directories first X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Sep 2003 10:05:28 -0000 --==========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 : 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==========--