summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-09-07 13:02:46 +0000
committerJim Meyering <jim@meyering.net>1998-09-07 13:02:46 +0000
commitf9ae8064f2cf09b4f916c254a3b7d1d78e16e46b (patch)
tree5de1709ccba722063da9320e40b3627320a65d73
parent9ce9d75ddb6e80f1628b43fc9bf4de67a316cfd3 (diff)
downloadcoreutils-f9ae8064f2cf09b4f916c254a3b7d1d78e16e46b.tar.xz
(print_dir_name): Put back.
(print_dir): Also print directory name header if print_dir_name is true.
-rw-r--r--src/ls.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ls.c b/src/ls.c
index ba604239a..79f0bf935 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -474,6 +474,10 @@ static int tabsize;
static int dir_defaulted;
+/* Nonzero means print each directory name before listing it. */
+
+static int print_dir_name;
+
/* The line length to use for breaking lines in many-per-line format.
Can be set with -w. */
@@ -683,6 +687,7 @@ main (int argc, char **argv)
exit_status = 0;
dir_defaulted = 1;
+ print_dir_name = 1;
pending_dirs = 0;
current_time = time ((time_t *) 0);
@@ -753,6 +758,8 @@ main (int argc, char **argv)
if (pending_dirs)
DIRED_PUTCHAR ('\n');
}
+ else if (pending_dirs && pending_dirs->next == 0)
+ print_dir_name = 0;
while (pending_dirs)
{
@@ -763,6 +770,7 @@ main (int argc, char **argv)
if (thispend->realname)
free (thispend->realname);
free (thispend);
+ print_dir_name = 1;
}
if (dired && format == long_format)
@@ -1581,8 +1589,10 @@ print_dir (const char *name, const char *realname)
contents listed rather than being mentioned here as files. */
if (trace_dirs)
+ extract_dirs_from_files (name, 1);
+
+ if (trace_dirs || print_dir_name)
{
- extract_dirs_from_files (name, 1);
DIRED_INDENT ();
PUSH_CURRENT_DIRED_POS (&subdired_obstack);
dired_pos += quote_name (stdout, realname ? realname : name,