KXML_POPALL(3)

πŸ“¦ version 1.0.1, in alpine 3.24

πŸŽ€ kxml_popall(3) πŸŽ€

okay bestie, so this one's from the libkcgixml library β€” yes, the manual is literally called KXML_POPALL and it's about closing all your element scopes for kcgixml. slay. let's get into it πŸ’…


✨ SYNOPSIS ✨

like, here's what you gotta include first, no cap:

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

enum kcgi_err
kxml_popall(struct kxmlreq *req);

πŸ¦‹ DESCRIPTION πŸ¦‹

So kxml_popall() closes all the open element scopes of req β€” and req is the one you initialised with kxml_open(3). icymi, scopes get opened with kxml_push(3) or kxml_pushattrs(3). 🫢

And if there are literally no open scopes? It does nothing. zero. nada. chill like that. ✨


πŸ’– RETURN VALUES πŸ’–

It returns an enum kcgi_err that tells you the error state. here's the vibe check on each one:

  • KCGI_OK β€” success, bestie! not an error at all 🌸
  • KCGI_ENOMEM β€” internal memory allocation failure 😭 the memory 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 one means khttp_body(3) didn't return with success, or was never invoked at all πŸ™ˆ for FastCGI connections, release the current connection with khttp_free(3) and reenter the parse loop
  • KCGI_SYSTEM β€” internal system error while writing to the output stream πŸ’€

🌈 EXAMPLES 🌈

okay so this little guy outputs a simple XML page. it assumes r is a struct kreq pointer. and for brevity it does no error checking (we're living dangerously, bestie 🧚):

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_push(&req, 1); /* bar */
kxml_push(&req, 2); /* baz */
kxml_popall(&req);
kxml_close(&req);

look at that. iconic. πŸ‘‘


πŸ‘€ SEE ALSO πŸ‘€


πŸ’œ AUTHORS πŸ’œ

Written by Kristaps Dzonsons <kristaps@bsd.lv>. king behaviour fr fr 🫑


ngl this page is from Debian, with the $Mdocdate$ version stamp β€” so yeah, that's the source and date situation, bestie. go forth and pop those scopes πŸ’…βœ¨πŸŽ€
πŸ“¦ 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