|
NAME
LIBRARYlibrary “libkcgi” SYNOPSIS
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.suffixpath/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)
or 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=xyzzyFor 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=0These 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.htmlpage.htmlLastly, 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=barAUTHORSWritten by Kristaps Dzonsons <kristaps@bsd.lv>.
|