diff options
author | tjr <tjr@FreeBSD.org> | 2002-10-18 10:59:45 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-10-18 10:59:45 +0000 |
commit | 55302b1f5d86e33fb0341565cc9dac950baad6a6 (patch) | |
tree | 1f627d419a97d1e0f2f2f202a153c66fbe02f3f6 /bin | |
parent | a96c7569e15921fa023426e26e355d6841135eda (diff) | |
download | FreeBSD-src-55302b1f5d86e33fb0341565cc9dac950baad6a6.zip FreeBSD-src-55302b1f5d86e33fb0341565cc9dac950baad6a6.tar.gz |
Print non-printing characters in directory names, as well as file names,
as `?' or `\ooo', depending on whether the -b or -B flags were used.
PR: 43995
MFC after: 1 month
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ls/extern.h | 1 | ||||
-rw-r--r-- | bin/ls/ls.c | 11 | ||||
-rw-r--r-- | bin/ls/print.c | 2 |
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) |