xref: /freebsd/contrib/vis/vis.1 (revision 15fccd86b9dd17ca2cc1a70b060a2b1a1bf8470b)
1*15fccd86SWarner Losh.\"	$NetBSD: vis.1,v 1.25 2021/02/20 09:31:51 nia Exp $
2f1f89080SBrooks Davis.\"
3f1f89080SBrooks Davis.\" Copyright (c) 1989, 1991, 1993, 1994
4f1f89080SBrooks Davis.\"	The Regents of the University of California.  All rights reserved.
5f1f89080SBrooks Davis.\"
6f1f89080SBrooks Davis.\" Redistribution and use in source and binary forms, with or without
7f1f89080SBrooks Davis.\" modification, are permitted provided that the following conditions
8f1f89080SBrooks Davis.\" are met:
9f1f89080SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright
10f1f89080SBrooks Davis.\"    notice, this list of conditions and the following disclaimer.
11f1f89080SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright
12f1f89080SBrooks Davis.\"    notice, this list of conditions and the following disclaimer in the
13f1f89080SBrooks Davis.\"    documentation and/or other materials provided with the distribution.
14f1f89080SBrooks Davis.\" 3. Neither the name of the University nor the names of its contributors
15f1f89080SBrooks Davis.\"    may be used to endorse or promote products derived from this software
16f1f89080SBrooks Davis.\"    without specific prior written permission.
17f1f89080SBrooks Davis.\"
18f1f89080SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19f1f89080SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20f1f89080SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21f1f89080SBrooks Davis.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22f1f89080SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23f1f89080SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24f1f89080SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25f1f89080SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26f1f89080SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27f1f89080SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28f1f89080SBrooks Davis.\" SUCH DAMAGE.
29f1f89080SBrooks Davis.\"
30f1f89080SBrooks Davis.\"     @(#)vis.1	8.4 (Berkeley) 4/19/94
31f1f89080SBrooks Davis.\"
32*15fccd86SWarner Losh.Dd February 18, 2021
33f1f89080SBrooks Davis.Dt VIS 1
34f1f89080SBrooks Davis.Os
35f1f89080SBrooks Davis.Sh NAME
36f1f89080SBrooks Davis.Nm vis
37f1f89080SBrooks Davis.Nd display non-printable characters in a visual format
38f1f89080SBrooks Davis.Sh SYNOPSIS
39f1f89080SBrooks Davis.Nm
40*15fccd86SWarner Losh.Op Fl bcfhlMmNnoSstw
41f1f89080SBrooks Davis.Op Fl e Ar extra
42f1f89080SBrooks Davis.Op Fl F Ar foldwidth
43f1f89080SBrooks Davis.Op Ar file ...
44f1f89080SBrooks Davis.Sh DESCRIPTION
45f1f89080SBrooks Davis.Nm
46f1f89080SBrooks Davisis a filter for converting non-printable characters
47f1f89080SBrooks Davisinto a visual representation.
48f1f89080SBrooks DavisIt differs from
49f1f89080SBrooks Davis.Ql cat -v
50f1f89080SBrooks Davisin that
51f1f89080SBrooks Davisthe form is unique and invertible.
52f1f89080SBrooks DavisBy default, all non-graphic
53f1f89080SBrooks Davischaracters except space, tab, and newline are encoded.
54f1f89080SBrooks DavisA detailed description of the
55f1f89080SBrooks Davisvarious visual formats is given in
56f1f89080SBrooks Davis.Xr vis 3 .
57f1f89080SBrooks Davis.Pp
58f1f89080SBrooks DavisThe options are as follows:
59f1f89080SBrooks Davis.Bl -tag -width Ds
60f1f89080SBrooks Davis.It Fl b
61f1f89080SBrooks DavisTurns off prepending of backslash before up-arrow control sequences
62f1f89080SBrooks Davisand meta characters, and disables the doubling of backslashes.
63f1f89080SBrooks DavisThis
64f1f89080SBrooks Davisproduces output which is neither invertible or precise, but does
65f1f89080SBrooks Davisrepresent a minimum of change to the input.
66f1f89080SBrooks DavisIt is similar to
67f1f89080SBrooks Davis.Dq Li cat -v .
68f1f89080SBrooks Davis.Pq Dv VIS_NOSLASH
69f1f89080SBrooks Davis.It Fl c
70f1f89080SBrooks DavisRequest a format which displays a small subset of the
71f1f89080SBrooks Davisnon-printable characters using C-style backslash sequences.
72f1f89080SBrooks Davis.Pq Dv VIS_CSTYLE
73f1f89080SBrooks Davis.It Fl e Ar extra
74f1f89080SBrooks DavisAlso encode characters in
75f1f89080SBrooks Davis.Ar extra ,
76f1f89080SBrooks Davisper
77f1f89080SBrooks Davis.Xr svis 3 .
78f1f89080SBrooks Davis.It Fl F Ar foldwidth
79f1f89080SBrooks DavisCauses
80f1f89080SBrooks Davis.Nm
81f1f89080SBrooks Davisto fold output lines to foldwidth columns (default 80), like
82f1f89080SBrooks Davis.Xr fold 1 ,
83f1f89080SBrooks Davisexcept
84f1f89080SBrooks Davisthat a hidden newline sequence is used, (which is removed
85f1f89080SBrooks Daviswhen inverting the file back to its original form with
86f1f89080SBrooks Davis.Xr unvis 1 ) .
87f1f89080SBrooks DavisIf the last character in the encoded file does not end in a newline,
88f1f89080SBrooks Davisa hidden newline sequence is appended to the output.
89f1f89080SBrooks DavisThis makes
90f1f89080SBrooks Davisthe output usable with various editors and other utilities which
91f1f89080SBrooks Davistypically don't work with partial lines.
92f1f89080SBrooks Davis.It Fl f
93f1f89080SBrooks DavisSame as
94f1f89080SBrooks Davis.Fl F .
95f1f89080SBrooks Davis.It Fl h
96f1f89080SBrooks DavisEncode using the URI encoding from RFC 1808.
97f1f89080SBrooks Davis.Pq Dv VIS_HTTPSTYLE
98f1f89080SBrooks Davis.It Fl l
99f1f89080SBrooks DavisMark newlines with the visible sequence
100f1f89080SBrooks Davis.Ql \e$ ,
101f1f89080SBrooks Davisfollowed by the newline.
102*15fccd86SWarner Losh.It Fl M
103*15fccd86SWarner LoshEncode all shell meta characters (implies
104*15fccd86SWarner Losh.Fl S ,
105*15fccd86SWarner Losh.Fl w ,
106*15fccd86SWarner Losh.Fl g )
107*15fccd86SWarner Losh.Pq Dv VIS_META
108f1f89080SBrooks Davis.It Fl m
109f1f89080SBrooks DavisEncode using the MIME Quoted-Printable encoding from RFC 2045.
110f1f89080SBrooks Davis.Pq Dv VIS_MIMESTYLE
111*15fccd86SWarner Losh.It Fl N
112*15fccd86SWarner LoshTurn on the
113*15fccd86SWarner Losh.Dv VIS_NOLOCALE
114*15fccd86SWarner Loshflag which encodes using the
115*15fccd86SWarner Losh.Dq C
116*15fccd86SWarner Loshlocale, removing any encoding dependencies caused by the current
117*15fccd86SWarner Loshlocale settings specified in the environment.
118f1f89080SBrooks Davis.It Fl n
119f1f89080SBrooks DavisTurns off any encoding, except for the fact that backslashes are
120f1f89080SBrooks Davisstill doubled and hidden newline sequences inserted if
121f1f89080SBrooks Davis.Fl f
122f1f89080SBrooks Davisor
123f1f89080SBrooks Davis.Fl F
124f1f89080SBrooks Davisis selected.
125f1f89080SBrooks DavisWhen combined with the
126f1f89080SBrooks Davis.Fl f
127f1f89080SBrooks Davisflag,
128f1f89080SBrooks Davis.Nm
129f1f89080SBrooks Davisbecomes like
130f1f89080SBrooks Davisan invertible version of the
131f1f89080SBrooks Davis.Xr fold 1
132f1f89080SBrooks Davisutility.
133f1f89080SBrooks DavisThat is, the output can be unfolded by running the output through
134f1f89080SBrooks Davis.Xr unvis 1 .
135f1f89080SBrooks Davis.It Fl o
136f1f89080SBrooks DavisRequest a format which displays non-printable characters as
137f1f89080SBrooks Davisan octal number, \eddd.
138f1f89080SBrooks Davis.Pq Dv VIS_OCTAL
139*15fccd86SWarner Losh.It Fl S
140*15fccd86SWarner LoshEncode shell meta-characters that are non-white space or glob.
141*15fccd86SWarner Losh.Pq Dv VIS_SHELL
142f1f89080SBrooks Davis.It Fl s
143f1f89080SBrooks DavisOnly characters considered unsafe to send to a terminal are encoded.
144f1f89080SBrooks DavisThis flag allows backspace, bell, and carriage return in addition
145f1f89080SBrooks Davisto the default space, tab and newline.
146f1f89080SBrooks Davis.Pq Dv VIS_SAFE
147f1f89080SBrooks Davis.It Fl t
148f1f89080SBrooks DavisTabs are also encoded.
149f1f89080SBrooks Davis.Pq Dv VIS_TAB
150f1f89080SBrooks Davis.It Fl w
151f1f89080SBrooks DavisWhite space (space-tab-newline) is also encoded.
152f1f89080SBrooks Davis.Pq Dv VIS_WHITE
153f1f89080SBrooks Davis.El
154f1f89080SBrooks Davis.Sh MULTIBYTE CHARACTER SUPPORT
155f1f89080SBrooks Davis.Nm
156f1f89080SBrooks Davissupports multibyte character input.
157f1f89080SBrooks DavisThe encoding conversion is influenced by the setting of the
158f1f89080SBrooks Davis.Ev LC_CTYPE
159f1f89080SBrooks Davisenvironment variable which defines the set of characters that can be
160f1f89080SBrooks Daviscopied without encoding.
161f1f89080SBrooks Davis.Pp
162f1f89080SBrooks DavisWhen 8-bit data is present in the input,
163f1f89080SBrooks Davis.Ev LC_CTYPE
164f1f89080SBrooks Davismust be set to the correct locale or to the C locale.
165f1f89080SBrooks DavisIf the locales of the data and the conversion are mismatched, multibyte
166f1f89080SBrooks Davischaracter recognition may fail and encoding will be performed byte-by-byte
167f1f89080SBrooks Davisinstead.
168f1f89080SBrooks Davis.Sh ENVIRONMENT
169f1f89080SBrooks Davis.Bl -tag -width ".Ev LC_CTYPE"
170f1f89080SBrooks Davis.It Ev LC_CTYPE
171f1f89080SBrooks DavisSpecify the locale of the input data.
172f1f89080SBrooks DavisSet to C if the input data locale is unknown.
17304803ab2SBaptiste Daroussin.El
174cee8be2cSFernando Apesteguía.Sh EXAMPLES
175cee8be2cSFernando ApesteguíaVisualize characters encoding white spaces and tabs:
176cee8be2cSFernando Apesteguía.Bd -literal -offset indent
177cee8be2cSFernando Apesteguía$ echo -e "\\x10\\n\\t" | vis -w -t
178cee8be2cSFernando Apesteguía\\^P\\012\\011\\012
179cee8be2cSFernando Apesteguía.Ed
180cee8be2cSFernando Apesteguía.Pp
181cee8be2cSFernando ApesteguíaSame as above but using `\\$' for newline followed by an actual newline:
182cee8be2cSFernando Apesteguía.Bd -literal -offset indent
183cee8be2cSFernando Apesteguía$ echo -e "\\x10\\n\\t" | vis -w -t -l
184cee8be2cSFernando Apesteguía\\^P\\$
185cee8be2cSFernando Apesteguía\\011\\$
186cee8be2cSFernando Apesteguía.Ed
187cee8be2cSFernando Apesteguía.Pp
188cee8be2cSFernando ApesteguíaVisualize string using URI encoding:
189cee8be2cSFernando Apesteguía.Bd -literal -offset indent
190cee8be2cSFernando Apesteguía$ echo http://www.freebsd.org | vis -h
191cee8be2cSFernando Apesteguíahttp%3a%2f%2fwww.freebsd.org%0a
192cee8be2cSFernando Apesteguía.Ed
193f1f89080SBrooks Davis.Sh SEE ALSO
194f1f89080SBrooks Davis.Xr unvis 1 ,
195f1f89080SBrooks Davis.Xr svis 3 ,
196f1f89080SBrooks Davis.Xr vis 3
197f1f89080SBrooks Davis.Sh HISTORY
198f1f89080SBrooks DavisThe
199f1f89080SBrooks Davis.Nm
200f1f89080SBrooks Daviscommand appears in
201f1f89080SBrooks Davis.Bx 4.4 .
202*15fccd86SWarner LoshMultibyte character support was added in
20304803ab2SBaptiste Daroussin.Nx 7.0
204f1f89080SBrooks Davisand
205f1f89080SBrooks Davis.Fx 9.2 .
206