KXML_PROLOGUE(3)

πŸ“¦ version 1.0.1, in alpine 3.24

πŸ’– KXML_PROLOGUE(3) πŸ’–

okay so bestie, welcome to kxml_prologue β€” she lives in the Library Functions Manual section, she's part of the kcgixml family, and honestly? she's the easiest little icon in the whole group chat. let me tell you everything 🫢


🌸 LIBRARY 🌸

she ships in the library β€œlibkcgixml” β€” that's the whole vibe, no cap ✨


πŸŽ€ SYNOPSIS πŸŽ€

like, here's how you summon her:

#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>
#include <kcgi.h>
#include <kcgixml.h>

enum kcgi_err
kxml_prologue(struct kxmlreq *req);

one function, one argument, zero drama πŸ’…


✨ DESCRIPTION ✨

so what she does is write the standard XML prologue into a context req that you already initialised with kxml_open(3). that's it. that's the whole job, and she does it flawlessly πŸ”₯

and the prologue she writes is literally this exact string:

<?xml version="1.0" encoding="utf-8" ?>

no cap, that's the one. every single time πŸ‘‘


πŸ’€ RETURN VALUES πŸ’€

she returns an enum kcgi_err so you know exactly what the vibe check said. here's the full lineup:

  • KCGI_OK β€” success!! not an error, she's just happy πŸ₯°
  • KCGI_ENOMEM β€” internal memory allocation failure 😭 the allocation said no
  • KCGI_HUP β€” the output connection has been terminated πŸ’” for FastCGI connections, you should release the current connection with khttp_free(3) and reenter the parse loop
  • KCGI_FORM β€” the connection is still expecting headers with khttp_head(3) πŸ™ˆ this means khttp_body(3) either didn't return with success or was never invoked at all. for FastCGI connections, same deal: release the current connection with khttp_free(3) and reenter the parse loop
  • KCGI_SYSTEM β€” internal system error writing to the output stream, like the OS fumbled the bag πŸ’€

πŸ¦‹ EXAMPLES πŸ¦‹

okay here's a whole lil XML page, start to finish. this assumes r is a struct kreq pointer. and for brevity (we're keeping it snack-sized, not a whole meal) it does zero error checking β€” iconic but chaotic of us πŸ™ˆ

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_prologue(&req);
kxml_push(&req, 0); /* foo */
kxml_puts(&req, "Hello, world");
kxml_close(&req);

see how kxml_prologue(&req) just slides in right after kxml_open? main character energy honestly 🌟


🌈 SEE ALSO 🌈

  • kcgixml(3) β€” go read the rest of the family, iykyk πŸ’œ

πŸ‘‘ AUTHORS πŸ‘‘

written by Kristaps Dzonsons <kristaps@bsd.lv> β€” ty for the lore, king 🫑


fr fr, that's the whole page: standard XML prologue, <?xml version="1.0" encoding="utf-8" ?>, five possible return values, and one very cute example. go forth and slay ✨

mwah πŸ’‹ this little page came to you from Debian, dated $Mdocdate$, and she's known as KXML_PROLOGUE(3) β€” see u in the next manpage bestie πŸŽ€

πŸ“¦ where this page comes from
  • alpine 3.24: kcgi-doc 1.0.1-r0 Β· ISC
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms