|
NAMEkhttp_urlpart , khttp_urlpartx ,
khttp_vurlpart ,
khttp_vurlpartx —
URL formatting for kcgi
LIBRARYlibrary “libkcgi”SYNOPSIS#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>
#include <kcgi.h>
char *
char *
char *
char *
DESCRIPTIONFormat a URL given the components following the domain. If the variable arguments are provided, append them as query string pairs.path/page.suffix path/page.suffix?key=val... If path is If the suffix is
The variable key-value arguments must be terminated with
The page, query string keys, and query string values are URL-encoded, but the path and the suffix are not. There are two deprecated forms of these functions:
RETURN VALUESReturn newly-allocated strings that must be freed with free(3) orNULL if allocation fails.
EXAMPLESThe following creates a relative URL with path, page, suffix, and query string parts.url = khttp_urlpart("/path", "html", "page", "foo", "bar", "baz", "xyzzy", NULL); This will assign the following URL: /path/page.html?foo=bar&baz=xyzzy For typed arguments, the extended form may be used. Integer and real literals must have the int64_t and double types, respectively. url = khttp_urlpartx("/path", "html", "page", "foo", KATTRX_INT, (int64_t)0, NULL); This assigns the following /path/page.html?foo=0 These may be made relative to the current page by omitting the
leading slash or passing url1 = khttp_urlpart("rel/path", "html", "page", NULL); url2 = khttp_urlpart(NULL, "html", "page", NULL); These assign the following, respectively: rel/path/page.html page.html Lastly, pages and their suffixes may be omitted entirely: url3 = khttp_urlpart("", "", "", "foo", "bar", NULL); url4 = khttp_urlpart(NULL, "", "", "foo", "bar", NULL); These assign the following: /?foo=bar ?foo=bar AUTHORSWritten by Kristaps Dzonsons <kristaps@bsd.lv>.
Visit the GSP FreeBSD Man Page Interface. |