Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Sep 1997 23:45:09 -0700 (PDT)
From:      Sean Eric Fagan <sef@FreeBSD.ORG>
To:        FreeBSD bugs mailing list <freebsd-bugs@FreeBSD.ORG>, roberte@MEP.Ruhr-Uni-Bochum.de
Subject:   Re: bin/4558: ls -d does not sort directories as plain files
Message-ID:  <199709180645.XAA02443@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

	`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));
  }




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