FORM_ALLOC(3)

NAME
form_alloc - parse application/x-www-form-urlencoded data

SYNOPSIS

#include <libweb/form.h>

int form_alloc(const char *data, struct form **f);

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

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

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

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

COPYRIGHT
Copyright (C) 2023-2025 libweb contributors

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.