summaryrefslogtreecommitdiff
path: root/src/ls.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1994-10-27 05:02:28 +0000
committerJim Meyering <jim@meyering.net>1994-10-27 05:02:28 +0000
commit2ba9e70e52ca41cd46e5177bdc9ee5cae51a0cb5 (patch)
tree1852989d7e11dfee95a0d213d7b0e24fea2def0c /src/ls.c
parent51244615e9f58dc51889a51b2e90572e5059db85 (diff)
downloadcoreutils-2ba9e70e52ca41cd46e5177bdc9ee5cae51a0cb5.tar.xz
merge with 3.9q
Diffstat (limited to 'src/ls.c')
-rw-r--r--src/ls.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/ls.c b/src/ls.c
index 7d1b874b3..1d5348e66 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -467,6 +467,15 @@ static size_t dired_pos;
#define FPUTS_LITERAL(s, stream) \
do {fputs ((s), (stream)); dired_pos += sizeof((s)) - 1;} while (0)
+#define DIRED_INDENT() \
+ do \
+ { \
+ /* FIXME: remove the `&& format == long_format' clause. */ \
+ if (dired && format == long_format) \
+ FPUTS_LITERAL (" ", stdout); \
+ } \
+ while (0)
+
/* With --dired, store pairs of beginning and ending indices of filenames. */
static struct obstack dired_obstack;
@@ -964,9 +973,7 @@ print_dir (name, realname)
{
const char *dir;
- /* FIXME: remove the `&& format == long_format' clause. */
- if (dired && format == long_format)
- FPUTS_LITERAL (" ", stdout);
+ DIRED_INDENT ();
dir = (realname ? realname : name);
PUSH_CURRENT_DIRED_POS (&subdired_obstack);
FPUTS (dir, stdout, strlen (dir));
@@ -977,6 +984,8 @@ print_dir (name, realname)
if (format == long_format || print_block_size)
{
char buf[6 + 20 + 1 + 1];
+
+ DIRED_INDENT ();
sprintf (buf, "total %u\n", total_blocks);
FPUTS (buf, stdout, strlen (buf));
}
@@ -1602,9 +1611,7 @@ print_long_format (f)
sprintf (p, "%s ", full_time ? timebuf : timebuf + 4);
p += strlen (p);
- if (dired)
- FPUTS_LITERAL (" ", stdout);
-
+ DIRED_INDENT ();
FPUTS (bigbuf, stdout, p - bigbuf);
PUSH_CURRENT_DIRED_POS (&dired_obstack);
print_name_with_quoting (f->name);