]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(decode_switches): If `dired' is set without
authorJim Meyering <jim@meyering.net>
Mon, 27 Jan 2003 10:45:48 +0000 (10:45 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 27 Jan 2003 10:45:48 +0000 (10:45 +0000)
`format == long_format', then silently reset dired.  This doesn't
change the behavior of ls (all prior uses of dired were protected
by `&& format == long_format'), and lets us...
(DIRED_INDENT): ... remove `format == long_format' conjunct.
(PUSH_CURRENT_DIRED_POS): Likewise.
(main): Likewise.

src/ls.c

index 75fa3ddf7ebf521bdcd547d6d75da5a635acb3a0..18204201d4456df816758b7927b4d3ceef9f520c 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -834,8 +834,7 @@ static size_t dired_pos;
 #define DIRED_INDENT()                                                 \
     do                                                                 \
       {                                                                        \
-       /* FIXME: remove the `&& format == long_format' clause.  */     \
-       if (dired && format == long_format)                             \
+       if (dired)                                                      \
          DIRED_FPUTS_LITERAL ("  ", stdout);                           \
       }                                                                        \
     while (0)
@@ -854,8 +853,7 @@ static struct obstack subdired_obstack;
 #define PUSH_CURRENT_DIRED_POS(obs)                                    \
   do                                                                   \
     {                                                                  \
-      /* FIXME: remove the `&& format == long_format' clause.  */      \
-      if (dired && format == long_format)                              \
+      if (dired)                                                       \
        obstack_grow ((obs), &dired_pos, sizeof (dired_pos));           \
     }                                                                  \
   while (0)
@@ -1128,7 +1126,7 @@ main (int argc, char **argv)
                       && (recursive || print_with_color
                           || indicator_style != none));
 
-  if (dired && format == long_format)
+  if (dired)
     {
       obstack_init (&dired_obstack);
       obstack_init (&subdired_obstack);
@@ -1207,7 +1205,7 @@ main (int argc, char **argv)
       print_dir_name = 1;
     }
 
-  if (dired && format == long_format)
+  if (dired)
     {
       /* No need to free these since we're about to exit.  */
       dired_dump_obstack ("//DIRED//", &dired_obstack);
@@ -1675,6 +1673,12 @@ decode_switches (int argc, char **argv)
   dirname_quoting_options = clone_quoting_options (NULL);
   set_char_quoting (dirname_quoting_options, ':', 1);
 
+  /* --dired is meaningful only with --format=long (-l).
+     Otherwise, ignore it.  FIXME: warn about this?
+     Alternatively, make --dired imply --format=long?  */
+  if (dired && format != long_format)
+    dired = 0;
+
   /* If -c or -u is specified and not -l (or any other option that implies -l),
      and no sort-type was specified, then sort by the ctime (-c) or atime (-u).
      The behavior of ls when using either -c or -u but with neither -l nor -t