aboutsummaryrefslogtreecommitdiff
path: root/doc/man3/form_alloc.3
blob: 33ba4d5c0df96365cb75bde34e2982647cc7ae68 (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
.TH FORM_ALLOC 3 2025-10-09 0.5.0 "libweb Library Reference"

.SH NAME
form_alloc \- parse application/x-www-form-urlencoded data

.SH SYNOPSIS
.LP
.nf
#include <libweb/form.h>
.P
int form_alloc(const char *\fIdata\fP, struct form **\fIf\fP);
.fi

.SH DESCRIPTION
The
.IR form_alloc (3)
function parses a
.I application/x-www-form-urlencoded
human-readable string from
.I data
and, if successful, allocates a
.I struct form
instance into
.IR f ,
which can then be used by other functions from this library.

.SH RETURN VALUE
On success, zero is returned and
.I f
is initialized to a valid pointer.
If
.I data
contains invalid data,
a positive integer is returned and
.I f
is not modified.
On fatal errors (e.g.: a failed memory allocation),
a negative integer is returned and
.I f
is not modified.

.SH EXAMPLE
See
.IR libweb_form (7)
for a complete example on how to use this library.

.SH SEE ALSO
.BR form_value (3),
.BR form_foreach (3),
.BR form_free (3),
.BR libweb_form (7).

.SH COPYRIGHT
Copyright (C) 2023-2025 libweb contributors
.P
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.