summaryrefslogtreecommitdiff
path: root/usr.bin/vis
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/vis')
-rw-r--r--usr.bin/vis/vis.119
-rw-r--r--usr.bin/vis/vis.c16
2 files changed, 27 insertions, 8 deletions
diff --git a/usr.bin/vis/vis.1 b/usr.bin/vis/vis.1
index c8a54f0f268..fb920ba4920 100644
--- a/usr.bin/vis/vis.1
+++ b/usr.bin/vis/vis.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: vis.1,v 1.9 2002/09/30 11:09:16 grant Exp $
+.\" $NetBSD: vis.1,v 1.10 2002/12/23 01:45:54 lukem Exp $
.\"
.\" Copyright (c) 1989, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" @(#)vis.1 8.4 (Berkeley) 4/19/94
.\"
-.Dd April 19, 1994
+.Dd December 23, 2002
.Dt VIS 1
.Os
.Sh NAME
@@ -42,6 +42,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl cbflnostw
+.Op Fl e Ar extra
.Op Fl F Ar foldwidth
.Op Ar file ...
.Sh DESCRIPTION
@@ -68,10 +69,17 @@ produces output which is neither invertible or precise, but does
represent a minimum of change to the input.
It is similar to
.Dq Li cat -v .
+.Pq Dv VIS_NOSLASH
.It Fl c
Request a format which displays a small subset of the
non-printable characters using C-style backslash sequences.
-.It Fl F
+.Pq Dv VIS_CSTYLE
+.It Fl e Ar extra
+Also encode characters in
+.Ar extra ,
+per
+.Xr svis 3 .
+.It Fl F Ar foldwidth
Causes
.Nm
to fold output lines to foldwidth columns (default 80), like
@@ -112,17 +120,22 @@ That is, the output can be unfolded by running the output through
.It Fl o
Request a format which displays non-printable characters as
an octal number, \eddd.
+.Pq Dv VIS_OCTAL
.It Fl s
Only characters considered unsafe to send to a terminal are encoded.
This flag allows backspace, bell, and carriage return in addition
to the default space, tab and newline.
+.Pq Dv VIS_SAFE
.It Fl t
Tabs are also encoded.
+.Pq Dv VIS_TAB
.It Fl w
White space (space-tab-newline) is also encoded.
+.Pq Dv VIS_WHITE
.El
.Sh SEE ALSO
.Xr unvis 1 ,
+.Xr svis 3 ,
.Xr vis 3
.Sh HISTORY
The
diff --git a/usr.bin/vis/vis.c b/usr.bin/vis/vis.c
index c0549d7ca96..7bb5055ff79 100644
--- a/usr.bin/vis/vis.c
+++ b/usr.bin/vis/vis.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vis.c,v 1.6 2000/07/05 00:35:28 itohy Exp $ */
+/* $NetBSD: vis.c,v 1.7 2002/12/23 01:45:54 lukem Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)vis.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: vis.c,v 1.6 2000/07/05 00:35:28 itohy Exp $");
+__RCSID("$NetBSD: vis.c,v 1.7 2002/12/23 01:45:54 lukem Exp $");
#endif /* not lint */
#include <stdio.h>
@@ -54,6 +54,7 @@ __RCSID("$NetBSD: vis.c,v 1.6 2000/07/05 00:35:28 itohy Exp $");
#include <vis.h>
int eflags, fold, foldwidth=80, none, markeol, debug;
+char *extra;
int foldit __P((char *, int, int));
int main __P((int, char **));
@@ -68,7 +69,7 @@ main(argc, argv)
int ch;
int rval;
- while ((ch = getopt(argc, argv, "nwctsobfF:ld")) != -1)
+ while ((ch = getopt(argc, argv, "nwctsobe:fF:ld")) != -1)
switch((char)ch) {
case 'n':
none++;
@@ -91,6 +92,9 @@ main(argc, argv)
case 'b':
eflags |= VIS_NOSLASH;
break;
+ case 'e':
+ extra = optarg;
+ break;
case 'F':
if ((foldwidth = atoi(optarg))<5) {
errx(1, "can't fold lines to less than 5 cols");
@@ -111,7 +115,7 @@ main(argc, argv)
case '?':
default:
fprintf(stderr,
- "usage: vis [-nwctsobf] [-F foldwidth]\n");
+ "Usage: vis [-nwctsobf] [-e extra] [-F foldwidth]\n");
exit(1);
}
argc -= optind;
@@ -161,7 +165,9 @@ process(fp, filename)
*cp++ = '$';
*cp++ = '\n';
*cp = '\0';
- } else
+ } else if (extra)
+ (void) svis(buff, (char)c, eflags, (char)rachar, extra);
+ else
(void) vis(buff, (char)c, eflags, (char)rachar);
cp = buff;