KHTML_CLOSE(3)
π KHTML_CLOSE β close kcgihtml context π
okay so this is a page from Library Functions Manual (section 3, the library-call girly section) and it's all about khtml_close, bestie. it's short, it's sweet, it's the closing credits of your HTML era. let's get into it π
β¨ LIBRARY β¨
library βlibkcgihtmlβ β that's the one, that's the squad π«Ά
β¨ SYNOPSIS β¨
like, here's the whole vibe up front:
#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>
#include <kcgi.h>
#include <kcgihtml.h>
enum kcgi_err
khtml_close(struct khtmlreq *req);
β¨ DESCRIPTION β¨
so khtml_close closes req β the context you already opened with khtml_open(3). and the way that every single scope you opened with khtml_attr(3), khtml_attrx(3), or khtml_elem(3) gets automatically closed for you?? we love a function that cleans up after itself. main character energy fr fr π§
β οΈ but listen β after this, req may no longer be used. like, at all. it's done. it's retired. don't call it, don't text it, don't try to sneak one more element out of it. periodt π
β¨ RETURN VALUES β¨
returns an enum kcgi_err telling you the error state. the possibilities:
KCGI_OKβ Success. not an error. slay πKCGI_ENOMEMβ internal memory allocation failure. the computer ran out of room π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 meanskhttp_body(3)did not return with success, or was not invoked at all. 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. rough. π«
β¨ EXAMPLES β¨
here's a whole lil' HTML page being born π it assumes r is a struct kreq pointer. and for brevity it does not do any error checking β iconic but chaotic, ngl:
khttp_head(r, kresps[KRESP_STATUS],
"%s", khttps[KHTTP_200]);
khttp_head(r, kresps[KRESP_CONTENT_TYPE],
"%s", kmimetypes[KMIME_TEXT_HTML]);
khttp_body(r);
khtml_open(&req, r, 0);
khtml_elem(&req, KELEM_DOCTYPE);
khtml_elem(&req, KELEM_HTML);
khtml_elem(&req, KELEM_BODY);
khtml_puts(&req, "Hello, world");
khtml_close(&req);
look at that β Hello, world and then khtml_close(&req) and we're out. no cap, that's the whole flex π
β¨ SEE ALSO β¨
kcgihtml(3)β go read the parent page, iykyk πΈ
β¨ STANDARDS β¨
the referenced HTML5 standard is HTML5.2: https://www.w3.org/TR/html52. β yes bestie, the link is literally right there π
β¨ AUTHORS β¨
Written by Kristaps Dzonsons <kristaps@bsd.lv>. π«Ά thank you king
π and that's the whole page, bestie. this particular rendering came from Debian, with the date placeholder $Mdocdate$ sitting in the footer spot, and the page answers to the name KHTML_CLOSE(3) β ok bye, close your scopes, hydrate, and go touch grass ππ¦
π¦ 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