summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/unvis.3
diff options
context:
space:
mode:
authoralex <alex@FreeBSD.org>2000-07-02 21:31:26 +0000
committeralex <alex@FreeBSD.org>2000-07-02 21:31:26 +0000
commit995a78eb83236c197a3d1fb37b7de757639d751f (patch)
tree4772c58dec37a5d24fb1f6992c883883be2351b2 /lib/libc/gen/unvis.3
parent7529622c2c77ec0057ab1617fffdbac83c01b82c (diff)
downloadFreeBSD-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/libc/gen/unvis.3')
-rw-r--r--lib/libc/gen/unvis.329
1 files changed, 26 insertions, 3 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
OpenPOWER on IntegriCloud