summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/ls/extern.h1
-rw-r--r--bin/ls/ls.c11
-rw-r--r--bin/ls/print.c2
3 files changed, 9 insertions, 5 deletions
diff --git a/bin/ls/extern.h b/bin/ls/extern.h
index d6b4208..7f480aa 100644
--- a/bin/ls/extern.h
+++ b/bin/ls/extern.h
@@ -45,6 +45,7 @@ int revstatcmp(const FTSENT *, const FTSENT *);
void printcol(DISPLAY *);
void printlong(DISPLAY *);
+int printname(const char *);
void printscol(DISPLAY *);
void printstream(DISPLAY *);
void usage(void);
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index be19f36..07ae826 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -470,10 +470,13 @@ traverse(int argc, char *argv[], int options)
* a separator. If multiple arguments, precede each
* directory with its name.
*/
- if (output)
- (void)printf("\n%s:\n", p->fts_path);
- else if (argc > 1) {
- (void)printf("%s:\n", p->fts_path);
+ if (output) {
+ putchar('\n');
+ printname(p->fts_path);
+ puts(":");
+ } else if (argc > 1) {
+ printname(p->fts_path);
+ puts(":");
output = 1;
}
chp = fts_children(ftsp, ch_options);
diff --git a/bin/ls/print.c b/bin/ls/print.c
index 4f2907a..ed87323 100644
--- a/bin/ls/print.c
+++ b/bin/ls/print.c
@@ -141,7 +141,7 @@ printscol(DISPLAY *dp)
/*
* print name in current style
*/
-static int
+int
printname(const char *name)
{
if (f_octal || f_octal_escape)
OpenPOWER on IntegriCloud