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
This commit is contained in:
tjr 2002-10-18 10:59:45 +00:00
parent a96c7569e1
commit 55302b1f5d
3 changed files with 9 additions and 5 deletions

View File

@ -45,6 +45,7 @@ int revstatcmp(const FTSENT *, const FTSENT *);
void printcol(DISPLAY *); void printcol(DISPLAY *);
void printlong(DISPLAY *); void printlong(DISPLAY *);
int printname(const char *);
void printscol(DISPLAY *); void printscol(DISPLAY *);
void printstream(DISPLAY *); void printstream(DISPLAY *);
void usage(void); void usage(void);

View File

@ -470,10 +470,13 @@ traverse(int argc, char *argv[], int options)
* a separator. If multiple arguments, precede each * a separator. If multiple arguments, precede each
* directory with its name. * directory with its name.
*/ */
if (output) if (output) {
(void)printf("\n%s:\n", p->fts_path); putchar('\n');
else if (argc > 1) { printname(p->fts_path);
(void)printf("%s:\n", p->fts_path); puts(":");
} else if (argc > 1) {
printname(p->fts_path);
puts(":");
output = 1; output = 1;
} }
chp = fts_children(ftsp, ch_options); chp = fts_children(ftsp, ch_options);

View File

@ -141,7 +141,7 @@ printscol(DISPLAY *dp)
/* /*
* print name in current style * print name in current style
*/ */
static int int
printname(const char *name) printname(const char *name)
{ {
if (f_octal || f_octal_escape) if (f_octal || f_octal_escape)