summary refs log tree commit diff stats
path: root/man/uri.3
blob: 03aa753b2dee428e30414ad36616e2b4d28a438c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
.Dd Jan 18, 2021
.Dt YURI 3
.Sh NAME
.Nm uri_new ,
.Nm uri_decode ,
.Nm uri_encode ,
.Nm uri_normalize ,
.Nm uri_free
.Nd URI object manipulation functions
.Sh SYNOPSIS
.In yuri.h
.Ft "struct uri *"
.Fn uri_new
.Ft "struct uri *"
.Fn uri_decode "const char *str"
.Ft "char *"
.Fn uri_encode "struct uri *u"
.Ft int
.Fn uri_normalize "struct uri *u"
.Ft void
.Fn uri_free "struct uri *u"
.Sh DESCRIPTION
.Fn uri_new
initializes a new URI object.
.Pp
.Fn uri_decode
decodes URI pointed to by string
.Em str
and returns a corresponding URI object.
.Pp
.Fn uri_encode
encodes URI object pointed to by
.Em u
and returns corresponding string.
.Pp
.Fn uri_normalize
normalizes URI object pointed to by
.Em u
as per section 6.2 of RFC 3986.
.Pp
.Fn uri_free
frees a URI object.
.Pp
For information on manipulating existing URI objects, refer to
.Xr uri_set 3
and
.Xr uri_unset 3 .
.Sh RETURN VALUES
.Fn uri_new
and
.Fn uri_decode
return a valid pointer to newly allocated URI object on success, or
.Nm NULL
on failure.
.Pp
.Fn uri_encode
return a valid string pointer on success, or
.Nm NULL
on failure.
.Pp
.Fn uri_normalize
returns
.Em 0
on success, or
.Em -1
on failure.
.Pp
Upon success, values returned by
.Fn uri_new
and
.Fn uri_decode
should be passed to
.Fn uri_free
after use,
and values returned by
.Fn uri_encode
should be passed to
.Fn free
after use.
.Sh SEE ALSO
.Xr uri_set 3 ,
.Xr uri_unset 3 ,
.Xr uri_get 3
.Sh AUTHORS
.An Ali Fardan Aq Mt raiz@stellarbound.space