From e16986212dc52bb04c7b60dc9d1433ee1eb4b43e Mon Sep 17 00:00:00 2001 From: joe Date: Sat, 29 Dec 2001 00:22:29 +0000 Subject: Force raw printing of non-printable characters via the -w option. PR: bin/28007 --- bin/ls/ls.1 | 8 ++++++-- bin/ls/ls.c | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/ls/ls.1 b/bin/ls/ls.1 index 4e892b0..c28cb16 100644 --- a/bin/ls/ls.1 +++ b/bin/ls/ls.1 @@ -43,7 +43,7 @@ .Nd list directory contents .Sh SYNOPSIS .Nm -.Op Fl ABCFGHLPRTWZabcdfghiklnoqrstu1 +.Op Fl ABCFGHLPRTWZabcdfghiklnoqrstuw1 .Op Ar .Sh DESCRIPTION For each operand that names a @@ -196,6 +196,9 @@ of the file for sorting .Pq Fl t or printing .Pq Fl l . +.It Fl w +Force raw printing of non-printable characters. This is the default +when output is not to a terminal. .It Fl \&1 (The numeric digit ``one.'') Force output to be one entry per line. @@ -220,7 +223,8 @@ the file time used. .Pp The .Fl B , -.Fl b +.Fl b , +.Fl w , and .Fl q options all override each other; the last one specified determines diff --git a/bin/ls/ls.c b/bin/ls/ls.c index f500426..1338841 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -166,7 +166,7 @@ main(argc, argv) f_listdot = 1; fts_options = FTS_PHYSICAL; - while ((ch = getopt(argc, argv, "1ABCFGHLPRTWZabcdfghiklnoqrstu")) != -1) { + while ((ch = getopt(argc, argv, "1ABCFGHLPRTWZabcdfghiklnoqrstuw")) != -1) { switch (ch) { /* * The -1, -C and -l options all override each other so shell @@ -275,6 +275,11 @@ main(argc, argv) f_octal = 0; f_octal_escape = 1; break; + case 'w': + f_nonprint = 0; + f_octal = 0; + f_octal_escape = 0; + break; case 'Z': f_lomac = 1; break; -- cgit v1.1