diff options
author | alex <alex@FreeBSD.org> | 2000-07-02 21:31:26 +0000 |
---|---|---|
committer | alex <alex@FreeBSD.org> | 2000-07-02 21:31:26 +0000 |
commit | 995a78eb83236c197a3d1fb37b7de757639d751f (patch) | |
tree | 4772c58dec37a5d24fb1f6992c883883be2351b2 /lib | |
parent | 7529622c2c77ec0057ab1617fffdbac83c01b82c (diff) | |
download | FreeBSD-src-995a78eb83236c197a3d1fb37b7de757639d751f.zip FreeBSD-src-995a78eb83236c197a3d1fb37b7de757639d751f.tar.gz |
Document VIS_HTTPSTYLE:
VIS_HTTPSTYLE is a new encoding style for use in vis(), strvis() and
strvisx() that escapes characters according to RFC 1808 (URI encoding).
Since decoding of these require different detection of start-points of
escaped characters, VIS_HTTPSTYLE can be given as flag to unvis().
unvis() will then properly decode URIs.
A new function appeared, strunvisx(): strunvisx() behaves similar as
strunvis(), with one exception: It has an additional flag parameter,
which is passed to unvis() to archive the effect I described above.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/unvis.3 | 29 | ||||
-rw-r--r-- | lib/libc/gen/vis.3 | 9 |
2 files changed, 34 insertions, 4 deletions
diff --git a/lib/libc/gen/unvis.3 b/lib/libc/gen/unvis.3 index f5bb169..ba6b38b 100644 --- a/lib/libc/gen/unvis.3 +++ b/lib/libc/gen/unvis.3 @@ -47,11 +47,14 @@ .Fn unvis "char *cp" "int c" "int *astate" "int flag" .Ft int .Fn strunvis "char *dst" "const char *src" +.Ft int +.Fn strunvisx "char *dst" "const char *src" "int flag" .Sh DESCRIPTION The -.Fn unvis -and +.Fn unvis , .Fn strunvis +and +.Fn strunvisx functions are used to decode a visual representation of characters, as produced by the @@ -89,6 +92,16 @@ equal to the size of decoding). .Pp The +.Fn strunvisx +function does the same as the +.Fn strunvis +function, but it allows you to add a flag that specifies the style the string +.Ar src +is encoded with. +Currently, the only supported flag is +.Dv VIS_HTTPSTYLE . +.Pp +The .Fn unvis function implements a state machine that can be used to decode an arbitrary @@ -126,10 +139,20 @@ unknown state. The decoder is placed into the starting state. .Pp When all bytes in the stream have been processed, call .Fn unvis -one more time with flag set to +one more time with +.Ar flag +set to .Dv UNVIS_END to extract any remaining character (the character passed in is ignored). .Pp +The +.Ar flag +argument is also used to specify the encoding style of the source. +If set to +.Dv VIS_HTTPSTYLE , +.Fn unvis +will decode URI strings as specified in RFC 1808. +.Pp The following code fragment illustrates a proper use of .Fn unvis . .Bd -literal -offset indent diff --git a/lib/libc/gen/vis.3 b/lib/libc/gen/vis.3 index 88d5b52..7612bd5 100644 --- a/lib/libc/gen/vis.3 +++ b/lib/libc/gen/vis.3 @@ -162,7 +162,7 @@ All forms use the backslash character to introduce a special sequence; two backslashes are used to represent a real backslash. These are the visual formats: -.Bl -tag -width VIS_CSTYLE +.Bl -tag -width VIS_HTTPSTYLE .It (default) Use an .Ql M @@ -238,6 +238,13 @@ If .Fa nextc is an octal digit, the latter representation is used to avoid ambiguity. +.It Dv VIS_HTTPSTYLE +Use URI encoding as described in RFC 1808. +The form is +.Ql %dd +where +.Em d +represents a hexadecimal digit. .It Dv VIS_OCTAL Use a three digit octal sequence. The form is .Ql \eddd |