KXML_POPALL(3)
π 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 noKCGI_HUPβ the output connection has been terminated. for FastCGI connections, you should release the current connection withkhttp_free(3)and reenter the parse loop π₯KCGI_FORMβ the connection is still expecting headers withkhttp_head(3). this one meanskhttp_body(3)didn't return with success, or was never invoked at all π for FastCGI connections, release the current connection withkhttp_free(3)and reenter the parse loopKCGI_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
- 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