KXML_PUTS(3)
πΈ NAME πΈ
okay bestie, this is the KXML_PUTS(3) page from the Library Functions Manual, and the function it's here to hype is kxml_write β the one that puts content data for kcgixml. No cap, that's the whole name vibe. π
π¦ LIBRARY π¦
This cutie lives in the library libkcgixml. π
β¨ SYNOPSIS β¨
#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>
#include <kcgi.h>
#include <kcgixml.h>
enum kcgi_err
kxml_write(const char *buf, size_t sz, void *arg);
π DESCRIPTION π
kxml_write writes binary data buf of length sz to a context arg, which is a struct kxmlreq initialised with kxml_open(3) and passed in as an opaque pointer. If buf is NULL or sz is zero, it does nothing and returns success. All of the content is XML escaped. π
π©· RETURN VALUES π©·
It returns an enum kcgi_err that tells you the error state, bestie. Here's the whole lineup:
KCGI_OKβ success, which is literally not an error. πKCGI_ENOMEMβ internal memory allocation failure. πKCGI_HUPβ the output connection has been terminated. For FastCGI connections, the current connection should be released withkhttp_free(3)and the parse loop reentered. πKCGI_FORMβ the connection is still expecting headers withkhttp_head(3). This indicates thatkhttp_body(3)did not return with success or was not invoked. For FastCGI connections, the current connection should be released withkhttp_free(3)and the parse loop reentered. πKCGI_SYSTEMβ internal system error writing to the output stream. π₯
π§ EXAMPLES π§
The following outputs a simple XML page. It assumes r is a struct kreq pointer. For brevity, it does not do any error checking. β¨
const char *const elems[] =
{ "foo", "bar", "baz" };
khttp_head(r, kresps[KRESP_STATUS],
"%s", khttps[KHTTP_200]);
khttp_head(r, kresps[KRESP_CONTENT_TYPE],
"%s", kmimetypes[KMIME_TEXT_XML]);
khttp_body(r);
kxml_open(&req, r, elems, 3);
kxml_push(&req, 0); /* foo */
kxml_puts(&req, "Hello, world");
kxml_close(&req);
π SEE ALSO π
π AUTHORS π
Written by Kristaps Dzonsons <kristaps@bsd.lv>. π
and that's the whole page, bestie β this Debian edition is dated $Mdocdate$, and the manual page itself is KXML_PUTS(3). mwah πβ¨
π¦ where this page comes from
- alpine 3.24: kcgi-doc 1.0.1-r0 Β· ISC
- Copyright (c) 2020 Kristaps Dzonsons <kristaps@bsd.lv>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms