From owner-freebsd-bugs Wed Sep 17 23:50:38 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id XAA12181 for bugs-outgoing; Wed, 17 Sep 1997 23:50:38 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id XAA12080; Wed, 17 Sep 1997 23:49:00 -0700 (PDT) Received: (from sef@localhost) by freefall.freebsd.org (8.8.6/8.8.5) id XAA02443; Wed, 17 Sep 1997 23:45:09 -0700 (PDT) Date: Wed, 17 Sep 1997 23:45:09 -0700 (PDT) Message-Id: <199709180645.XAA02443@freefall.freebsd.org> From: Sean Eric Fagan To: FreeBSD bugs mailing list , roberte@MEP.Ruhr-Uni-Bochum.de Subject: Re: bin/4558: ls -d does not sort directories as plain files Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk `Sean Eric Fagan' changed the state to `closed'. State-Changed-From-To: open-closed State-Changed-By: sef State-Changed-When: Wed Sep 17 23:43:23 1997 State-Changed-Why: I just checked in a diff for this. (Okay, this isn't the exact diff I checked in, this is the patch I got from Keith. But it applied cleanly :).) Index: ls.c =================================================================== RCS file: /master/bin/ls/ls.c,v retrieving revision 2.3 retrieving revision 2.4 diff -c -r2.3 -r2.4 *** ls.c 1996/01/09 21:14:03 2.3 --- ls.c 1996/01/21 03:59:47 2.4 *************** *** 519,534 **** if (a_info == FTS_NS || b_info == FTS_NS) return (namecmp(*a, *b)); ! if (a_info == b_info) ! return (sortfcn(*a, *b)); ! ! if ((*a)->fts_level == FTS_ROOTLEVEL) if (a_info == FTS_D) return (1); ! else if (b_info == FTS_D) return (-1); ! else ! return (sortfcn(*a, *b)); ! else ! return (sortfcn(*a, *b)); } --- 519,530 ---- if (a_info == FTS_NS || b_info == FTS_NS) return (namecmp(*a, *b)); ! if (a_info != b_info && ! (*a)->fts_level == FTS_ROOTLEVEL && !f_listdir) { if (a_info == FTS_D) return (1); ! if (b_info == FTS_D) return (-1); ! } ! return (sortfcn(*a, *b)); }