xref: /freebsd/contrib/libc-vis/vis.3 (revision 8ccca1222d3d9e815f972a7acfc18a034ce4a4bb)
1*8ccca122SBrooks Davis.\"	$NetBSD: vis.3,v 1.29 2012/12/14 22:55:59 christos Exp $
2*8ccca122SBrooks Davis.\"	$FreeBSD$
3*8ccca122SBrooks Davis.\"
4*8ccca122SBrooks Davis.\" Copyright (c) 1989, 1991, 1993
5*8ccca122SBrooks Davis.\"	The Regents of the University of California.  All rights reserved.
6*8ccca122SBrooks Davis.\"
7*8ccca122SBrooks Davis.\" Redistribution and use in source and binary forms, with or without
8*8ccca122SBrooks Davis.\" modification, are permitted provided that the following conditions
9*8ccca122SBrooks Davis.\" are met:
10*8ccca122SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright
11*8ccca122SBrooks Davis.\"    notice, this list of conditions and the following disclaimer.
12*8ccca122SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright
13*8ccca122SBrooks Davis.\"    notice, this list of conditions and the following disclaimer in the
14*8ccca122SBrooks Davis.\"    documentation and/or other materials provided with the distribution.
15*8ccca122SBrooks Davis.\" 3. Neither the name of the University nor the names of its contributors
16*8ccca122SBrooks Davis.\"    may be used to endorse or promote products derived from this software
17*8ccca122SBrooks Davis.\"    without specific prior written permission.
18*8ccca122SBrooks Davis.\"
19*8ccca122SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20*8ccca122SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*8ccca122SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*8ccca122SBrooks Davis.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23*8ccca122SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*8ccca122SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25*8ccca122SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26*8ccca122SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27*8ccca122SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28*8ccca122SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29*8ccca122SBrooks Davis.\" SUCH DAMAGE.
30*8ccca122SBrooks Davis.\"
31*8ccca122SBrooks Davis.\"     @(#)vis.3	8.1 (Berkeley) 6/9/93
32*8ccca122SBrooks Davis.\"
33*8ccca122SBrooks Davis.Dd December 14, 2012
34*8ccca122SBrooks Davis.Dt VIS 3
35*8ccca122SBrooks Davis.Os
36*8ccca122SBrooks Davis.Sh NAME
37*8ccca122SBrooks Davis.Nm vis ,
38*8ccca122SBrooks Davis.Nm nvis ,
39*8ccca122SBrooks Davis.Nm strvis ,
40*8ccca122SBrooks Davis.Nm strnvis ,
41*8ccca122SBrooks Davis.Nm strvisx ,
42*8ccca122SBrooks Davis.Nm strnvisx ,
43*8ccca122SBrooks Davis.Nm svis ,
44*8ccca122SBrooks Davis.Nm snvis ,
45*8ccca122SBrooks Davis.Nm strsvis ,
46*8ccca122SBrooks Davis.Nm strsnvis ,
47*8ccca122SBrooks Davis.Nm strsvisx
48*8ccca122SBrooks Davis.Nm strsnvisx
49*8ccca122SBrooks Davis.Nd visually encode characters
50*8ccca122SBrooks Davis.Sh LIBRARY
51*8ccca122SBrooks Davis.Lb libc
52*8ccca122SBrooks Davis.Sh SYNOPSIS
53*8ccca122SBrooks Davis.In vis.h
54*8ccca122SBrooks Davis.Ft char *
55*8ccca122SBrooks Davis.Fn vis "char *dst" "int c" "int flag" "int nextc"
56*8ccca122SBrooks Davis.Ft char *
57*8ccca122SBrooks Davis.Fn nvis "char *dst" "size_t dlen" "int c" "int flag" "int nextc"
58*8ccca122SBrooks Davis.Ft int
59*8ccca122SBrooks Davis.Fn strvis "char *dst" "const char *src" "int flag"
60*8ccca122SBrooks Davis.Ft int
61*8ccca122SBrooks Davis.Fn strnvis "char *dst" "size_t dlen" "const char *src" "int flag"
62*8ccca122SBrooks Davis.Ft int
63*8ccca122SBrooks Davis.Fn strvisx "char *dst" "const char *src" "size_t len" "int flag"
64*8ccca122SBrooks Davis.Ft int
65*8ccca122SBrooks Davis.Fn strnvisx "char *dst" "size_t dlen" "const char *src" "size_t len" "int flag"
66*8ccca122SBrooks Davis.Ft char *
67*8ccca122SBrooks Davis.Fn svis "char *dst" "int c" "int flag" "int nextc" "const char *extra"
68*8ccca122SBrooks Davis.Ft char *
69*8ccca122SBrooks Davis.Fn snvis "char *dst" "size_t dlen" "int c" "int flag" "int nextc" "const char *extra"
70*8ccca122SBrooks Davis.Ft int
71*8ccca122SBrooks Davis.Fn strsvis "char *dst" "const char *src" "int flag" "const char *extra"
72*8ccca122SBrooks Davis.Ft int
73*8ccca122SBrooks Davis.Fn strsnvis "char *dst" "size_t dlen" "const char *src" "int flag" "const char *extra"
74*8ccca122SBrooks Davis.Ft int
75*8ccca122SBrooks Davis.Fn strsvisx "char *dst" "const char *src" "size_t len" "int flag" "const char *extra"
76*8ccca122SBrooks Davis.Ft int
77*8ccca122SBrooks Davis.Fn strsnvisx "char *dst" "size_t dlen" "const char *src" "size_t len" "int flag" "const char *extra"
78*8ccca122SBrooks Davis.Sh DESCRIPTION
79*8ccca122SBrooks DavisThe
80*8ccca122SBrooks Davis.Fn vis
81*8ccca122SBrooks Davisfunction
82*8ccca122SBrooks Daviscopies into
83*8ccca122SBrooks Davis.Fa dst
84*8ccca122SBrooks Davisa string which represents the character
85*8ccca122SBrooks Davis.Fa c .
86*8ccca122SBrooks DavisIf
87*8ccca122SBrooks Davis.Fa c
88*8ccca122SBrooks Davisneeds no encoding, it is copied in unaltered.
89*8ccca122SBrooks DavisThe string is null terminated, and a pointer to the end of the string is
90*8ccca122SBrooks Davisreturned.
91*8ccca122SBrooks DavisThe maximum length of any encoding is four
92*8ccca122SBrooks Davischaracters (not including the trailing
93*8ccca122SBrooks Davis.Dv NUL ) ;
94*8ccca122SBrooks Davisthus, when
95*8ccca122SBrooks Davisencoding a set of characters into a buffer, the size of the buffer should
96*8ccca122SBrooks Davisbe four times the number of characters encoded, plus one for the trailing
97*8ccca122SBrooks Davis.Dv NUL .
98*8ccca122SBrooks DavisThe flag parameter is used for altering the default range of
99*8ccca122SBrooks Davischaracters considered for encoding and for altering the visual
100*8ccca122SBrooks Davisrepresentation.
101*8ccca122SBrooks DavisThe additional character,
102*8ccca122SBrooks Davis.Fa nextc ,
103*8ccca122SBrooks Davisis only used when selecting the
104*8ccca122SBrooks Davis.Dv VIS_CSTYLE
105*8ccca122SBrooks Davisencoding format (explained below).
106*8ccca122SBrooks Davis.Pp
107*8ccca122SBrooks DavisThe
108*8ccca122SBrooks Davis.Fn strvis ,
109*8ccca122SBrooks Davis.Fn strnvis ,
110*8ccca122SBrooks Davis.Fn strvisx ,
111*8ccca122SBrooks Davisand
112*8ccca122SBrooks Davis.Fn strnvisx
113*8ccca122SBrooks Davisfunctions copy into
114*8ccca122SBrooks Davis.Fa dst
115*8ccca122SBrooks Davisa visual representation of
116*8ccca122SBrooks Davisthe string
117*8ccca122SBrooks Davis.Fa src .
118*8ccca122SBrooks DavisThe
119*8ccca122SBrooks Davis.Fn strvis
120*8ccca122SBrooks Davisand
121*8ccca122SBrooks Davis.Fn strnvis
122*8ccca122SBrooks Davisfunctions encode characters from
123*8ccca122SBrooks Davis.Fa src
124*8ccca122SBrooks Davisup to the
125*8ccca122SBrooks Davisfirst
126*8ccca122SBrooks Davis.Dv NUL .
127*8ccca122SBrooks DavisThe
128*8ccca122SBrooks Davis.Fn strvisx
129*8ccca122SBrooks Davisand
130*8ccca122SBrooks Davis.Fn strnvisx
131*8ccca122SBrooks Davisfunctions encode exactly
132*8ccca122SBrooks Davis.Fa len
133*8ccca122SBrooks Davischaracters from
134*8ccca122SBrooks Davis.Fa src
135*8ccca122SBrooks Davis(this
136*8ccca122SBrooks Davisis useful for encoding a block of data that may contain
137*8ccca122SBrooks Davis.Dv NUL Ns 's ) .
138*8ccca122SBrooks DavisBoth forms
139*8ccca122SBrooks Davis.Dv NUL
140*8ccca122SBrooks Davisterminate
141*8ccca122SBrooks Davis.Fa dst .
142*8ccca122SBrooks DavisThe size of
143*8ccca122SBrooks Davis.Fa dst
144*8ccca122SBrooks Davismust be four times the number
145*8ccca122SBrooks Davisof characters encoded from
146*8ccca122SBrooks Davis.Fa src
147*8ccca122SBrooks Davis(plus one for the
148*8ccca122SBrooks Davis.Dv NUL ) .
149*8ccca122SBrooks DavisBoth
150*8ccca122SBrooks Davisforms return the number of characters in dst (not including
151*8ccca122SBrooks Davisthe trailing
152*8ccca122SBrooks Davis.Dv NUL ) .
153*8ccca122SBrooks DavisThe
154*8ccca122SBrooks Davis.Dq n
155*8ccca122SBrooks Davisversions of the functions also take an additional argument
156*8ccca122SBrooks Davis.Fa dlen
157*8ccca122SBrooks Davisthat indicates the length of the
158*8ccca122SBrooks Davis.Fa dst
159*8ccca122SBrooks Davisbuffer.
160*8ccca122SBrooks DavisIf
161*8ccca122SBrooks Davis.Fa dlen
162*8ccca122SBrooks Davisis not large enough to fix the converted string then the
163*8ccca122SBrooks Davis.Fn strnvis
164*8ccca122SBrooks Davisand
165*8ccca122SBrooks Davis.Fn strnvisx
166*8ccca122SBrooks Davisfunctions return \-1 and set
167*8ccca122SBrooks Davis.Va errno
168*8ccca122SBrooks Davisto
169*8ccca122SBrooks Davis.Dv ENOSPC .
170*8ccca122SBrooks Davis.Pp
171*8ccca122SBrooks DavisThe functions
172*8ccca122SBrooks Davis.Fn svis ,
173*8ccca122SBrooks Davis.Fn snvis ,
174*8ccca122SBrooks Davis.Fn strsvis ,
175*8ccca122SBrooks Davis.Fn strsnvis ,
176*8ccca122SBrooks Davis.Fn strsvisx ,
177*8ccca122SBrooks Davisand
178*8ccca122SBrooks Davis.Fn strsnvisx
179*8ccca122SBrooks Daviscorrespond to
180*8ccca122SBrooks Davis.Fn vis ,
181*8ccca122SBrooks Davis.Fn nvis ,
182*8ccca122SBrooks Davis.Fn strvis ,
183*8ccca122SBrooks Davis.Fn strnvis ,
184*8ccca122SBrooks Davis.Fn strvisx ,
185*8ccca122SBrooks Davisand
186*8ccca122SBrooks Davis.Fn strnvisx
187*8ccca122SBrooks Davisbut have an additional argument
188*8ccca122SBrooks Davis.Fa extra ,
189*8ccca122SBrooks Davispointing to a
190*8ccca122SBrooks Davis.Dv NUL
191*8ccca122SBrooks Davisterminated list of characters.
192*8ccca122SBrooks DavisThese characters will be copied encoded or backslash-escaped into
193*8ccca122SBrooks Davis.Fa dst .
194*8ccca122SBrooks DavisThese functions are useful e.g. to remove the special meaning
195*8ccca122SBrooks Davisof certain characters to shells.
196*8ccca122SBrooks Davis.Pp
197*8ccca122SBrooks DavisThe encoding is a unique, invertible representation composed entirely of
198*8ccca122SBrooks Davisgraphic characters; it can be decoded back into the original form using
199*8ccca122SBrooks Davisthe
200*8ccca122SBrooks Davis.Xr unvis 3 ,
201*8ccca122SBrooks Davis.Xr strunvis 3
202*8ccca122SBrooks Davisor
203*8ccca122SBrooks Davis.Xr strnunvis 3
204*8ccca122SBrooks Davisfunctions.
205*8ccca122SBrooks Davis.Pp
206*8ccca122SBrooks DavisThere are two parameters that can be controlled: the range of
207*8ccca122SBrooks Davischaracters that are encoded (applies only to
208*8ccca122SBrooks Davis.Fn vis ,
209*8ccca122SBrooks Davis.Fn nvis ,
210*8ccca122SBrooks Davis.Fn strvis ,
211*8ccca122SBrooks Davis.Fn strnvis ,
212*8ccca122SBrooks Davis.Fn strvisx ,
213*8ccca122SBrooks Davisand
214*8ccca122SBrooks Davis.Fn strnvisx ) ,
215*8ccca122SBrooks Davisand the type of representation used.
216*8ccca122SBrooks DavisBy default, all non-graphic characters,
217*8ccca122SBrooks Davisexcept space, tab, and newline are encoded.
218*8ccca122SBrooks Davis(See
219*8ccca122SBrooks Davis.Xr isgraph 3 . )
220*8ccca122SBrooks DavisThe following flags
221*8ccca122SBrooks Davisalter this:
222*8ccca122SBrooks Davis.Bl -tag -width VIS_WHITEX
223*8ccca122SBrooks Davis.It Dv VIS_GLOB
224*8ccca122SBrooks DavisAlso encode magic characters
225*8ccca122SBrooks Davis.Ql ( * ,
226*8ccca122SBrooks Davis.Ql \&? ,
227*8ccca122SBrooks Davis.Ql \&[
228*8ccca122SBrooks Davisand
229*8ccca122SBrooks Davis.Ql # )
230*8ccca122SBrooks Davisrecognized by
231*8ccca122SBrooks Davis.Xr glob 3 .
232*8ccca122SBrooks Davis.It Dv VIS_SP
233*8ccca122SBrooks DavisAlso encode space.
234*8ccca122SBrooks Davis.It Dv VIS_TAB
235*8ccca122SBrooks DavisAlso encode tab.
236*8ccca122SBrooks Davis.It Dv VIS_NL
237*8ccca122SBrooks DavisAlso encode newline.
238*8ccca122SBrooks Davis.It Dv VIS_WHITE
239*8ccca122SBrooks DavisSynonym for
240*8ccca122SBrooks Davis.Dv VIS_SP
241*8ccca122SBrooks Davis\&|
242*8ccca122SBrooks Davis.Dv VIS_TAB
243*8ccca122SBrooks Davis\&|
244*8ccca122SBrooks Davis.Dv VIS_NL .
245*8ccca122SBrooks Davis.It Dv VIS_SAFE
246*8ccca122SBrooks DavisOnly encode "unsafe" characters.
247*8ccca122SBrooks DavisUnsafe means control characters which may cause common terminals to perform
248*8ccca122SBrooks Davisunexpected functions.
249*8ccca122SBrooks DavisCurrently this form allows space, tab, newline, backspace, bell, and
250*8ccca122SBrooks Davisreturn - in addition to all graphic characters - unencoded.
251*8ccca122SBrooks Davis.El
252*8ccca122SBrooks Davis.Pp
253*8ccca122SBrooks Davis(The above flags have no effect for
254*8ccca122SBrooks Davis.Fn svis ,
255*8ccca122SBrooks Davis.Fn snvis ,
256*8ccca122SBrooks Davis.Fn strsvis ,
257*8ccca122SBrooks Davis.Fn strsnvis ,
258*8ccca122SBrooks Davis.Fn strsvisx ,
259*8ccca122SBrooks Davisand
260*8ccca122SBrooks Davis.Fn strsnvisx .
261*8ccca122SBrooks DavisWhen using these functions, place all graphic characters to be
262*8ccca122SBrooks Davisencoded in an array pointed to by
263*8ccca122SBrooks Davis.Fa extra .
264*8ccca122SBrooks DavisIn general, the backslash character should be included in this array, see the
265*8ccca122SBrooks Daviswarning on the use of the
266*8ccca122SBrooks Davis.Dv VIS_NOSLASH
267*8ccca122SBrooks Davisflag below).
268*8ccca122SBrooks Davis.Pp
269*8ccca122SBrooks DavisThere are four forms of encoding.
270*8ccca122SBrooks DavisAll forms use the backslash character
271*8ccca122SBrooks Davis.Ql \e
272*8ccca122SBrooks Davisto introduce a special
273*8ccca122SBrooks Davissequence; two backslashes are used to represent a real backslash,
274*8ccca122SBrooks Davisexcept
275*8ccca122SBrooks Davis.Dv VIS_HTTPSTYLE
276*8ccca122SBrooks Davisthat uses
277*8ccca122SBrooks Davis.Ql % ,
278*8ccca122SBrooks Davisor
279*8ccca122SBrooks Davis.Dv VIS_MIMESTYLE
280*8ccca122SBrooks Davisthat uses
281*8ccca122SBrooks Davis.Ql = .
282*8ccca122SBrooks DavisThese are the visual formats:
283*8ccca122SBrooks Davis.Bl -tag -width VIS_CSTYLE
284*8ccca122SBrooks Davis.It (default)
285*8ccca122SBrooks DavisUse an
286*8ccca122SBrooks Davis.Ql M
287*8ccca122SBrooks Davisto represent meta characters (characters with the 8th
288*8ccca122SBrooks Davisbit set), and use caret
289*8ccca122SBrooks Davis.Ql ^
290*8ccca122SBrooks Davisto represent control characters see
291*8ccca122SBrooks Davis.Pf ( Xr iscntrl 3 ) .
292*8ccca122SBrooks DavisThe following formats are used:
293*8ccca122SBrooks Davis.Bl -tag -width xxxxx
294*8ccca122SBrooks Davis.It Dv \e^C
295*8ccca122SBrooks DavisRepresents the control character
296*8ccca122SBrooks Davis.Ql C .
297*8ccca122SBrooks DavisSpans characters
298*8ccca122SBrooks Davis.Ql \e000
299*8ccca122SBrooks Davisthrough
300*8ccca122SBrooks Davis.Ql \e037 ,
301*8ccca122SBrooks Davisand
302*8ccca122SBrooks Davis.Ql \e177
303*8ccca122SBrooks Davis(as
304*8ccca122SBrooks Davis.Ql \e^? ) .
305*8ccca122SBrooks Davis.It Dv \eM-C
306*8ccca122SBrooks DavisRepresents character
307*8ccca122SBrooks Davis.Ql C
308*8ccca122SBrooks Daviswith the 8th bit set.
309*8ccca122SBrooks DavisSpans characters
310*8ccca122SBrooks Davis.Ql \e241
311*8ccca122SBrooks Davisthrough
312*8ccca122SBrooks Davis.Ql \e376 .
313*8ccca122SBrooks Davis.It Dv \eM^C
314*8ccca122SBrooks DavisRepresents control character
315*8ccca122SBrooks Davis.Ql C
316*8ccca122SBrooks Daviswith the 8th bit set.
317*8ccca122SBrooks DavisSpans characters
318*8ccca122SBrooks Davis.Ql \e200
319*8ccca122SBrooks Davisthrough
320*8ccca122SBrooks Davis.Ql \e237 ,
321*8ccca122SBrooks Davisand
322*8ccca122SBrooks Davis.Ql \e377
323*8ccca122SBrooks Davis(as
324*8ccca122SBrooks Davis.Ql \eM^? ) .
325*8ccca122SBrooks Davis.It Dv \e040
326*8ccca122SBrooks DavisRepresents
327*8ccca122SBrooks Davis.Tn ASCII
328*8ccca122SBrooks Davisspace.
329*8ccca122SBrooks Davis.It Dv \e240
330*8ccca122SBrooks DavisRepresents Meta-space.
331*8ccca122SBrooks Davis.El
332*8ccca122SBrooks Davis.Pp
333*8ccca122SBrooks Davis.It Dv VIS_CSTYLE
334*8ccca122SBrooks DavisUse C-style backslash sequences to represent standard non-printable
335*8ccca122SBrooks Davischaracters.
336*8ccca122SBrooks DavisThe following sequences are used to represent the indicated characters:
337*8ccca122SBrooks Davis.Bd -unfilled -offset indent
338*8ccca122SBrooks Davis.Li \ea Tn  - BEL No (007)
339*8ccca122SBrooks Davis.Li \eb Tn  - BS No (010)
340*8ccca122SBrooks Davis.Li \ef Tn  - NP No (014)
341*8ccca122SBrooks Davis.Li \en Tn  - NL No (012)
342*8ccca122SBrooks Davis.Li \er Tn  - CR No (015)
343*8ccca122SBrooks Davis.Li \es Tn  - SP No (040)
344*8ccca122SBrooks Davis.Li \et Tn  - HT No (011)
345*8ccca122SBrooks Davis.Li \ev Tn  - VT No (013)
346*8ccca122SBrooks Davis.Li \e0 Tn  - NUL No (000)
347*8ccca122SBrooks Davis.Ed
348*8ccca122SBrooks Davis.Pp
349*8ccca122SBrooks DavisWhen using this format, the nextc parameter is looked at to determine
350*8ccca122SBrooks Davisif a
351*8ccca122SBrooks Davis.Dv NUL
352*8ccca122SBrooks Davischaracter can be encoded as
353*8ccca122SBrooks Davis.Ql \e0
354*8ccca122SBrooks Davisinstead of
355*8ccca122SBrooks Davis.Ql \e000 .
356*8ccca122SBrooks DavisIf
357*8ccca122SBrooks Davis.Fa nextc
358*8ccca122SBrooks Davisis an octal digit, the latter representation is used to
359*8ccca122SBrooks Davisavoid ambiguity.
360*8ccca122SBrooks Davis.It Dv VIS_OCTAL
361*8ccca122SBrooks DavisUse a three digit octal sequence.
362*8ccca122SBrooks DavisThe form is
363*8ccca122SBrooks Davis.Ql \eddd
364*8ccca122SBrooks Daviswhere
365*8ccca122SBrooks Davis.Em d
366*8ccca122SBrooks Davisrepresents an octal digit.
367*8ccca122SBrooks Davis.It Dv VIS_HTTPSTYLE
368*8ccca122SBrooks DavisUse URI encoding as described in RFC 1738.
369*8ccca122SBrooks DavisThe form is
370*8ccca122SBrooks Davis.Ql %xx
371*8ccca122SBrooks Daviswhere
372*8ccca122SBrooks Davis.Em x
373*8ccca122SBrooks Davisrepresents a lower case hexadecimal digit.
374*8ccca122SBrooks Davis.It Dv VIS_MIMESTYLE
375*8ccca122SBrooks DavisUse MIME Quoted-Printable encoding as described in RFC 2045, only don't
376*8ccca122SBrooks Davisbreak lines and don't handle CRLF.
377*8ccca122SBrooks DavisThe form is:
378*8ccca122SBrooks Davis.Ql %XX
379*8ccca122SBrooks Daviswhere
380*8ccca122SBrooks Davis.Em X
381*8ccca122SBrooks Davisrepresents an upper case hexadecimal digit.
382*8ccca122SBrooks Davis.El
383*8ccca122SBrooks Davis.Pp
384*8ccca122SBrooks DavisThere is one additional flag,
385*8ccca122SBrooks Davis.Dv VIS_NOSLASH ,
386*8ccca122SBrooks Daviswhich inhibits the
387*8ccca122SBrooks Davisdoubling of backslashes and the backslash before the default
388*8ccca122SBrooks Davisformat (that is, control characters are represented by
389*8ccca122SBrooks Davis.Ql ^C
390*8ccca122SBrooks Davisand
391*8ccca122SBrooks Davismeta characters as
392*8ccca122SBrooks Davis.Ql M-C ) .
393*8ccca122SBrooks DavisWith this flag set, the encoding is
394*8ccca122SBrooks Davisambiguous and non-invertible.
395*8ccca122SBrooks Davis.Sh ERRORS
396*8ccca122SBrooks DavisThe functions
397*8ccca122SBrooks Davis.Fn nvis
398*8ccca122SBrooks Davisand
399*8ccca122SBrooks Davis.Fn snvis
400*8ccca122SBrooks Daviswill return
401*8ccca122SBrooks Davis.Dv NULL
402*8ccca122SBrooks Davisand the functions
403*8ccca122SBrooks Davis.Fn strnvis ,
404*8ccca122SBrooks Davis.Fn strnvisx ,
405*8ccca122SBrooks Davis.Fn strsnvis ,
406*8ccca122SBrooks Davisand
407*8ccca122SBrooks Davis.Fn strsnvisx ,
408*8ccca122SBrooks Daviswill return \-1 when the
409*8ccca122SBrooks Davis.Fa dlen
410*8ccca122SBrooks Davisdestination buffer length size is not enough to perform the conversion while
411*8ccca122SBrooks Davissetting
412*8ccca122SBrooks Davis.Va errno
413*8ccca122SBrooks Davisto:
414*8ccca122SBrooks Davis.Bl -tag -width Er
415*8ccca122SBrooks Davis.It Bq Er ENOSPC
416*8ccca122SBrooks DavisThe destination buffer size is not large enough to perform the conversion.
417*8ccca122SBrooks Davis.El
418*8ccca122SBrooks Davis.Sh SEE ALSO
419*8ccca122SBrooks Davis.Xr unvis 1 ,
420*8ccca122SBrooks Davis.Xr vis 1 ,
421*8ccca122SBrooks Davis.Xr glob 3 ,
422*8ccca122SBrooks Davis.Xr unvis 3
423*8ccca122SBrooks Davis.Rs
424*8ccca122SBrooks Davis.%A T. Berners-Lee
425*8ccca122SBrooks Davis.%T Uniform Resource Locators (URL)
426*8ccca122SBrooks Davis.%O RFC1738
427*8ccca122SBrooks Davis.Re
428*8ccca122SBrooks Davis.Sh HISTORY
429*8ccca122SBrooks DavisThe
430*8ccca122SBrooks Davis.Fn vis ,
431*8ccca122SBrooks Davis.Fn strvis ,
432*8ccca122SBrooks Davisand
433*8ccca122SBrooks Davis.Fa strvisx
434*8ccca122SBrooks Davisfunctions first appeared in
435*8ccca122SBrooks Davis.Bx 4.4 .
436*8ccca122SBrooks DavisThe
437*8ccca122SBrooks Davis.Fn svis ,
438*8ccca122SBrooks Davis.Fn strsvis ,
439*8ccca122SBrooks Davisand
440*8ccca122SBrooks Davis.Fn strsvisx
441*8ccca122SBrooks Davisfunctions appeared in
442*8ccca122SBrooks Davis.Nx 1.5
443*8ccca122SBrooks Davisand
444*8ccca122SBrooks Davis.Fx 10.0 .
445*8ccca122SBrooks DavisThe buffer size limited versions of the functions
446*8ccca122SBrooks Davis.Po Fn nvis ,
447*8ccca122SBrooks Davis.Fn strnvis ,
448*8ccca122SBrooks Davis.Fn strnvisx ,
449*8ccca122SBrooks Davis.Fn snvis ,
450*8ccca122SBrooks Davis.Fn strsnvis ,
451*8ccca122SBrooks Davisand
452*8ccca122SBrooks Davis.Fn strsnvisx Pc
453*8ccca122SBrooks Davisappeared in
454*8ccca122SBrooks Davis.Nx 6.0
455*8ccca122SBrooks Davisand
456*8ccca122SBrooks Davis.Fx 10.0 .
457