--- src/lib/libc/gen/vis.3 2003/06/17 04:26:42 1.2 +++ src/lib/libc/gen/vis.3 2005/09/03 15:29:02 1.3 @@ -30,10 +30,10 @@ .\" SUCH DAMAGE. .\" .\" From: @(#)vis.3 8.1 (Berkeley) 6/9/93 -.\" $FreeBSD: src/lib/libc/gen/vis.3,v 1.8.2.6 2001/12/14 18:33:51 ru Exp $ -.\" $DragonFly: src/lib/libc/gen/vis.3,v 1.1 2003/06/16 04:26:13 dillon Exp $ +.\" $FreeBSD: src/lib/libc/gen/vis.3,v 1.27 2005/01/15 11:40:33 ru Exp $ +.\" $DragonFly$ .\" -.Dd July 25, 1996 +.Dd March 21, 2004 .Dt VIS 3 .Os .Sh NAME @@ -59,16 +59,20 @@ a string which represents the character .Fa c . If .Fa c -needs no encoding, it is copied in unaltered. The string is +needs no encoding, it is copied in unaltered. +The string is null terminated, and a pointer to the end of the string is -returned. The maximum length of any encoding is four +returned. +The maximum length of any encoding is four characters (not including the trailing .Dv NUL ) ; thus, when encoding a set of characters into a buffer, the size of the buffer should be four times the number of characters encoded, plus one for the trailing .Dv NUL . -The flag parameter is used for altering the default range of +The +.Fa flag +argument is used for altering the default range of characters considered for encoding and for altering the visual representation. The additional character, @@ -136,6 +140,15 @@ except space, tab, and newline are encod The following flags alter this: .Bl -tag -width VIS_WHITEX +.It Dv VIS_GLOB +Also encode magic characters +.Ql ( * , +.Ql \&? , +.Ql \&[ +and +.Ql # ) +recognized by +.Xr glob 3 . .It Dv VIS_SP Also encode space. .It Dv VIS_TAB @@ -150,9 +163,11 @@ Synonym for \&| .Dv VIS_NL . .It Dv VIS_SAFE -Only encode "unsafe" characters. Unsafe means control +Only encode "unsafe" characters. +Unsafe means control characters which may cause common terminals to perform -unexpected functions. Currently this form allows space, +unexpected functions. +Currently this form allows space, tab, newline, backspace, bell, and return - in addition to all graphic characters - unencoded. .El @@ -168,7 +183,7 @@ These are the visual formats: Use an .Ql M to represent meta characters (characters with the 8th -bit set), and use carat +bit set), and use caret .Ql ^ to represent control characters see .Pf ( Xr iscntrl 3 ) . @@ -217,18 +232,29 @@ Represents Meta-space. Use C-style backslash sequences to represent standard non-printable characters. The following sequences are used to represent the indicated characters: -.Bd -unfilled -offset indent -.Li \ea Tn - BEL No (007) -.Li \eb Tn - BS No (010) -.Li \ef Tn - NP No (014) -.Li \en Tn - NL No (012) -.Li \er Tn - CR No (015) -.Li \et Tn - HT No (011) -.Li \ev Tn - VT No (013) -.Li \e0 Tn - NUL No (000) -.Ed .Pp -When using this format, the nextc parameter is looked at to determine +.Bl -tag -width ".Li \e0" -offset indent -compact +.It Li \ea +.Dv BEL No (007) +.It Li \eb +.Dv BS No (010) +.It Li \ef +.Dv NP No (014) +.It Li \en +.Dv NL No (012) +.It Li \er +.Dv CR No (015) +.It Li \et +.Dv HT No (011) +.It Li \ev +.Dv VT No (013) +.It Li \e0 +.Dv NUL No (000) +.El +.Pp +When using this format, the +.Fa nextc +argument is looked at to determine if a .Dv NUL character can be encoded as @@ -244,13 +270,14 @@ Use URI encoding as described in RFC 180 The form is .Ql %dd where -.Em d +.Ar d represents a hexadecimal digit. .It Dv VIS_OCTAL -Use a three digit octal sequence. The form is +Use a three digit octal sequence. +The form is .Ql \eddd where -.Em d +.Ar d represents an octal digit. .El .Pp @@ -276,3 +303,9 @@ ambiguous and non-invertible. .Sh HISTORY These functions first appeared in .Bx 4.4 . +.Sh BUGS +The +.Nm +family of functions do not recognize multibyte characters, and thus +may consider them to be non-printable when they are in fact printable +(and vice versa.)