summaryrefslogtreecommitdiff
path: root/lib/libc/gen/unvis.3
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2002-03-23 17:38:27 +0000
committerchristos <christos@NetBSD.org>2002-03-23 17:38:27 +0000
commite20c30d79415b1fdd55b176fcda19dcfc4e899d4 (patch)
tree39dea70bd3fa4aa27f22f321186d0927a3c4b82e /lib/libc/gen/unvis.3
parent4498b37c8b676e3e369f23111c13ab341a3d3a90 (diff)
- Add VIS_HTTPSTYLE from FreeBSD.
- svis, strsvis, strsvisx were not reversible, because they did not encode \\ unless it was passed in the extras array. - Fix documentation to match the proper signature of the functions.
Diffstat (limited to 'lib/libc/gen/unvis.3')
-rw-r--r--lib/libc/gen/unvis.337
1 files changed, 32 insertions, 5 deletions
diff --git a/lib/libc/gen/unvis.3 b/lib/libc/gen/unvis.3
index 68b348749bb..7aa1b67c853 100644
--- a/lib/libc/gen/unvis.3
+++ b/lib/libc/gen/unvis.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: unvis.3,v 1.13 2002/02/07 09:24:05 ross Exp $
+.\" $NetBSD: unvis.3,v 1.14 2002/03/23 17:38:27 christos Exp $
.\"
.\" Copyright (c) 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -45,14 +45,17 @@
.Sh SYNOPSIS
.Fd #include \*[Lt]vis.h\*[Gt]
.Ft int
-.Fn unvis "char *cp" "char c" "int *astate" "int flag"
+.Fn unvis "char *cp" "int c" "int *astate" "int flag"
.Ft int
-.Fn strunvis "char *dst" "char *src"
+.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
@@ -92,6 +95,17 @@ should be equal to the size of
(that is, no expansion takes place during 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 stream of bytes.
@@ -132,6 +146,14 @@ one more time with 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
@@ -162,6 +184,11 @@ if (unvis(\*[Am]out, (char)0, \*[Am]state, UNVIS_END) == UNVIS_VALID)
.Xr unvis 1 ,
.Xr vis 1 ,
.Xr vis 3
+.Rs
+.%A R. Fielding
+.%T Relative Uniform Resource Locators
+.%O RFC1808
+.Re
.Sh HISTORY
The
.Fn unvis