summaryrefslogtreecommitdiffstats
path: root/bin/ls
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2001-12-29 00:22:29 +0000
committerjoe <joe@FreeBSD.org>2001-12-29 00:22:29 +0000
commite16986212dc52bb04c7b60dc9d1433ee1eb4b43e (patch)
tree813c6ac4f1de2e8e42cc5f84427f85045fa5540a /bin/ls
parent4771d6130329d531407b442ce0ce8f1e2d98a34a (diff)
downloadFreeBSD-src-e16986212dc52bb04c7b60dc9d1433ee1eb4b43e.zip
FreeBSD-src-e16986212dc52bb04c7b60dc9d1433ee1eb4b43e.tar.gz
Force raw printing of non-printable characters via the -w option.
PR: bin/28007
Diffstat (limited to 'bin/ls')
-rw-r--r--bin/ls/ls.18
-rw-r--r--bin/ls/ls.c7
2 files changed, 12 insertions, 3 deletions
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;
OpenPOWER on IntegriCloud