summaryrefslogtreecommitdiff
path: root/lib/libc/gen/unvis.3
diff options
context:
space:
mode:
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 f5bb169168dd..ba6b38b3fa1b 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