KXML_PUTC(3)

πŸ“¦ version 1.0.1, in alpine 3.24

🌸 NAME 🌸

okay so bestie, this is KXML_PUTC(3) β€” the manual page for kxml_putc, and the NAME is literally kxml_putc β€” put character content for kcgixml πŸ’…. That's the whole vibe, periodt.

πŸŽ€ LIBRARY πŸŽ€

It lives in the library libkcgixml β€” yes, the libkcgixml, the one with the fancy quotes in the original, slay ✨.

✨ SYNOPSIS ✨

Like, here's the exact incantation, no cap:

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

enum kcgi_err
kxml_putc(struct kxmlreq *req, char c);

πŸ¦‹ DESCRIPTION πŸ¦‹

It writes a NUL-terminated string cp to a context req initialised with kxml_open(3) β€” yes, the page says cp even though the signature above takes char c, iykyk 😭. The character is XML escaped, obvi.

πŸ’– RETURN VALUES πŸ’–

It returns an enum kcgi_err that tells you the error state, bestie. The options are:

  • KCGI_OK β€” success, not an error. we love a win πŸŽ‰
  • KCGI_ENOMEM β€” internal memory allocation failure. oof 😭
  • KCGI_HUP β€” the output connection has been terminated. For FastCGI connections, the current connection should be released with khttp_free(3) and the parse loop reentered. important!
  • KCGI_FORM β€” the connection is still expecting headers with khttp_head(3). This indicates that khttp_body(3) did not return with success or was not invoked. For FastCGI connections, the current connection should be released with khttp_free(3) and the parse loop reentered. don't skip the body, bestie.
  • 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. copy-paste responsibly 🫢

             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_putc(&req, 'H');
             kxml_putc(&req, 'i');
             kxml_putc(&req, '!');
             kxml_close(&req);

πŸ‘‘ SEE ALSO πŸ‘‘

kcgixml(3) β€” that's the whole see-also squad, bestie. ✨

πŸ“ AUTHORS πŸ“

Written by Kristaps Dzonsons <kristaps@bsd.lv>. iconic πŸ‘‘


xoxo, this page is from Debian, with the $Mdocdate$ date/version stamp, and it's KXML_PUTC(3) β€” bye 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