1.\" $NetBSD: vis.1,v 1.23 2015/05/24 19:42:39 christos Exp $ 2.\" 3.\" Copyright (c) 1989, 1991, 1993, 1994 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)vis.1 8.4 (Berkeley) 4/19/94 31.\" 32.Dd June 10, 2018 33.Dt VIS 1 34.Os 35.Sh NAME 36.Nm vis 37.Nd display non-printable characters in a visual format 38.Sh SYNOPSIS 39.Nm 40.Op Fl abcfhlMmNnoSstw 41.Op Fl e Ar extra 42.Op Fl F Ar foldwidth 43.Op Ar file ... 44.Sh DESCRIPTION 45.Nm 46is a filter for converting non-printable characters 47into a visual representation. 48It differs from 49.Ql cat -v 50in that 51the form is unique and invertible. 52By default, all non-graphic 53characters except space, tab, and newline are encoded. 54A detailed description of the 55various visual formats is given in 56.Xr vis 3 . 57.Pp 58The options are as follows: 59.Bl -tag -width Ds 60.It Fl a 61Encode all characters, whether originally visible or not. 62.Pq Dv VIS_ALL 63.It Fl b 64Turns off prepending of backslash before up-arrow control sequences 65and meta characters, and disables the doubling of backslashes. 66This 67produces output which is neither invertible or precise, but does 68represent a minimum of change to the input. 69It is similar to 70.Dq Li cat -v . 71.Pq Dv VIS_NOSLASH 72.It Fl c 73Request a format which displays a small subset of the 74non-printable characters using C-style backslash sequences. 75.Pq Dv VIS_CSTYLE 76.It Fl e Ar extra 77Also encode characters in 78.Ar extra , 79per 80.Xr svis 3 . 81.It Fl F Ar foldwidth 82Causes 83.Nm 84to fold output lines to foldwidth columns (default 80), like 85.Xr fold 1 , 86except 87that a hidden newline sequence is used, (which is removed 88when inverting the file back to its original form with 89.Xr unvis 1 ) . 90If the last character in the encoded file does not end in a newline, 91a hidden newline sequence is appended to the output. 92This makes 93the output usable with various editors and other utilities which 94typically don't work with partial lines. 95.It Fl f 96Same as 97.Fl F . 98.It Fl h 99Encode using the URI encoding from RFC 1808. 100.Pq Dv VIS_HTTPSTYLE 101.It Fl l 102Mark newlines with the visible sequence 103.Ql \e$ , 104followed by the newline. 105.It Fl M 106Encode all shell meta characters (implies 107.Fl S , 108.Fl w , 109.Fl g ) 110.Pq Dv VIS_META 111.It Fl m 112Encode using the MIME Quoted-Printable encoding from RFC 2045. 113.Pq Dv VIS_MIMESTYLE 114.It Fl N 115Turn on the 116.Dv VIS_NOLOCALE 117flag which encodes using the 118.Dq C 119locale, removing any encoding dependencies caused by the current 120locale settings specified in the environment. 121.It Fl n 122Turns off any encoding, except for the fact that backslashes are 123still doubled and hidden newline sequences inserted if 124.Fl f 125or 126.Fl F 127is selected. 128When combined with the 129.Fl f 130flag, 131.Nm 132becomes like 133an invertible version of the 134.Xr fold 1 135utility. 136That is, the output can be unfolded by running the output through 137.Xr unvis 1 . 138.It Fl o 139Request a format which displays non-printable characters as 140an octal number, \eddd. 141.Pq Dv VIS_OCTAL 142.It Fl S 143Encode shell meta-characters that are non-white space or glob. 144.Pq Dv VIS_SHELL 145.It Fl s 146Only characters considered unsafe to send to a terminal are encoded. 147This flag allows backspace, bell, and carriage return in addition 148to the default space, tab and newline. 149.Pq Dv VIS_SAFE 150.It Fl t 151Tabs are also encoded. 152.Pq Dv VIS_TAB 153.It Fl w 154White space (space-tab-newline) is also encoded. 155.Pq Dv VIS_WHITE 156.El 157.Sh MULTIBYTE CHARACTER SUPPORT 158.Nm 159supports multibyte character input. 160The encoding conversion is influenced by the setting of the 161.Ev LC_CTYPE 162environment variable which defines the set of characters that can be 163copied without encoding. 164.Pp 165When 8-bit data is present in the input, 166.Ev LC_CTYPE 167must be set to the correct locale or to the C locale. 168If the locales of the data and the conversion are mismatched, multibyte 169character recognition may fail and encoding will be performed byte-by-byte 170instead. 171.Sh ENVIRONMENT 172.Bl -tag -width ".Ev LC_CTYPE" 173.It Ev LC_CTYPE 174Specify the locale of the input data. 175Set to C if the input data locale is unknown. 176.El 177.Sh SEE ALSO 178.Xr unvis 1 , 179.Xr svis 3 , 180.Xr vis 3 181.Sh HISTORY 182The 183.Nm 184command appeared in 185.Bx 4.4 . 186Multibyte character support was added in 187.Nx 7.0 188and 189.Fx 9.2 . 190