Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Sep 1997 18:48:36 -0700 (PDT)
From:      Sean Eric Fagan <sef@Kithrup.COM>
To:        roberte@MEP.Ruhr-Uni-Bochum.de
Cc:        bugs@freebsd.org
Subject:   Re: bin/4558: ls -d does not sort directories as plain files
Message-ID:  <199709170148.SAA06961@kithrup.com>
In-Reply-To: <199709162318.BAA19822.kithrup.freebsd.bugs@ghost.mep.ruhr-uni-bochum.de>

next in thread | previous in thread | raw e-mail | index | archive | help
># cd to_an_empty_test_directory
># touch a c
># mkdir b
># ls -l
>total 1
>-rw-rw-r--  1 roberte  work    0 17 Sep 00:58 a
>drwxrwxr-x  2 roberte  work  512 17 Sep 00:58 b
>-rw-rw-r--  1 roberte  work    0 17 Sep 00:58 c
># ls -ld *
>-rw-rw-r--  1 roberte  work    0 17 Sep 00:58 a
>-rw-rw-r--  1 roberte  work    0 17 Sep 00:58 c
>drwxrwxr-x  2 roberte  work  512 17 Sep 00:58 b

I think I've figured out what's going on here; I've asked keith bostic for
confirmation.  In the meanwhile, I've got this patch, which seems to do the
trick.  (I don't think it's *quite* right, though.)

*** ls.c.~1~	Tue Aug 27 14:51:48 1996
--- ls.c	Tue Sep 16 18:34:56 1997
***************
*** 519,525 ****
  	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));
--- 519,525 ----
  	if ((*a)->fts_level == FTS_ROOTLEVEL)
  		if (a_info == FTS_D)
  			return (1);
! 		else if (b_info == FTS_D && !f_listdir)
  			return (-1);
  		else
  			return (sortfcn(*a, *b));



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