[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new ls option: --group-directories-first

From: Eric Blake
Subject: Re: new ls option: --group-directories-first
Date: Sat, 29 Apr 2006 15:48:26 +0000

> I've checked in your changes, with minor syntactic changes,
> and will add test cases next week.
> Thank you for contributing that.
> Francesco Montorsi <address@hidden> wrote:
> > 2005-12-27  Francesco Montorsi  <address@hidden>
> >
> >     Add a --group-directories-first option to ls to group
> >     directories before files.

First, a big congrats to Francesco for your persistence, patience,
and a good patch.  As evidenced by other threads on this list,
too many people give up when they are told that copyright
assignment must be made, or that their patch is incomplete or
needs to be reworked, or that more justification is needed before
the patch would be accepted.

I do think, however, that we needs a followup patch for
optimization on systems with a valid d_type.

I also wonder if the new macro DEFINE_SORT_FUNCTIONS and
LIST_SORTFUNCTION_VARIANTS will cause a problem on a platform
where basename is defined as a macro in <libgen.h>, since these
macros used `basename' as a macro parameter (in general, it is
a good idea to name macro parameters with something not
reserved by a standards document).  However, it didn't bother me
enough to patch it.

2006-04-29  Eric Blake  <address@hidden>

        * src/ls.c (main): On systems with d_type, directories_first only
        implies format_needs_type, not format_needs_stat.

Eric Blake

Index: src/ls.c
RCS file: /sources/coreutils/coreutils/src/ls.c,v
retrieving revision 1.410
diff -u -p -r1.410 ls.c
--- src/ls.c    23 Apr 2006 21:35:04 -0000      1.410
+++ src/ls.c    29 Apr 2006 15:45:51 -0000
@@ -1229,11 +1229,11 @@ main (int argc, char **argv)
   format_needs_stat = sort_type == sort_time || sort_type == sort_size
     || format == long_format
-    || print_block_size
-    || directories_first;
+    || print_block_size;
   format_needs_type = (! format_needs_stat
                       && (recursive || print_with_color
-                          || indicator_style != none));
+                          || indicator_style != none
+                          || directories_first));
   if (dired)
@@ -3029,9 +3029,9 @@ static int xstrcoll_version (V a, V b)
 static int rev_xstrcoll_version (V a, V b)
 { return cmp_version (b, a); }
 static int xstrcoll_df_version (V a, V b)
-{ DIRFIRST_CHECK (a,b); return cmp_version (a, b); }
+{ DIRFIRST_CHECK (a, b); return cmp_version (a, b); }
 static int rev_xstrcoll_df_version (V a, V b)
-{ DIRFIRST_CHECK (a,b); return cmp_version (b, a); }
+{ DIRFIRST_CHECK (a, b); return cmp_version (b, a); }
 /* We have 2^3 different variants for each sortkey function

reply via email to

[Prev in Thread] Current Thread [Next in Thread]