summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-01-27 10:45:48 +0000
committerJim Meyering <jim@meyering.net>2003-01-27 10:45:48 +0000
commit7f93a5421a9e694b9a66f1475d7b670bc05b2ac8 (patch)
tree5e50b5578bfb33668c2b33548e4e53695080df77
parentab43d63c3a25f9b6b0c775ac89ff904b10cd868f (diff)
downloadcoreutils-7f93a5421a9e694b9a66f1475d7b670bc05b2ac8.tar.xz
(decode_switches): If `dired' is set without
`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.
-rw-r--r--src/ls.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/ls.c b/src/ls.c
index 75fa3ddf7..18204201d 100644
--- 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