From de7f4b2ffcd92dfeada9235ce857b801a4851da7 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Thu, 9 Oct 2025 11:18:03 +0200 Subject: Add man3 pages for the form API --- doc/man3/form_foreach.3 | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 doc/man3/form_foreach.3 (limited to 'doc/man3/form_foreach.3') diff --git a/doc/man3/form_foreach.3 b/doc/man3/form_foreach.3 new file mode 100644 index 0000000..1c28600 --- /dev/null +++ b/doc/man3/form_foreach.3 @@ -0,0 +1,54 @@ +.TH FORM_FOREACH 3 2025-10-09 0.5.0 "libweb Library Reference" + +.SH NAME +form_foreach \- parse application/x-www-form-urlencoded data + +.SH SYNOPSIS +.LP +.nf +#include +.P +typedef int (*\fIform_iter\fP)(const char *\fIkey\fP, const char *\fIvalue\fP, void *\fIuser\fP); + +int form_foreach(const struct form *\fIf\fP, form_iter \fIit\fP, void *\fIuser\fP); +.fi + +.SH DESCRIPTION +The +.IR form_foreach (3) +function takes a +.I struct form +instance previously allocated by +.IR form_alloc (3), +pointed to by +.IR f , +and iterates over the object, calling the user-defined function pointed to by +.I it +for every key-value pair. + +.SH RETURN VALUE +On success, zero is returned. +Any non-zero return value coming from +.I it +makes +.IR form_foreach (3) +to stop its execution and propagate the return value to the caller. + +.SH EXAMPLE +See +.IR libweb_form (7) +for a complete example on how to use this library. + +.SH SEE ALSO +.BR form_alloc (3), +.BR form_value (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. -- cgit v1.2.3