KHTML_ENTITY(3)
π KHTML_ENTITY(3) β the khtml_entity glow-up π
okay bestie, so this one lives in the Library Functions Manual and it's from libkcgihtml β and no, you're not tripping, the function is literally called khttp_entity. yes the page is khtml_entity and the function is khttp_entity. that's just how it is. iykyk π
β¨ NAME β¨
khtml_entity β drop the content of a named character entity, for kcgihtml π¦
πΈ LIBRARY πΈ
library βlibkcgihtmlβ π
π SYNOPSIS π
#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>
#include <kcgi.h>
#include <kcgihtml.h>
enum kcgi_err
khttp_entity(struct kreq *req, enum entity v);
π DESCRIPTION π
so what it does is: it writes a named character entity v into a context req that was already initialised with khtml_open(3). and it formats that value as "&#xNNNN;" β literally. that's the whole vibe check. β¨
π RETURN VALUES π
it hands you back an enum kcgi_err that tells you the error state. so like, the mood ring of the call:
KCGI_OKβ success, which is lowkey not an error at all π«ΆKCGI_ENOMEMβ internal memory allocation failure. the malloc said no πKCGI_HUPβ the output connection has been terminated. for FastCGI connections, you should release the current connection withkhttp_free(3)and reenter the parse loop. (yes, reenter. go back in. π)KCGI_FORMβ the connection is still expecting headers withkhttp_head(3). this meanskhttp_body(3)didn't return with success, or it just wasn't invoked at all π. for FastCGI connections, release the current connection withkhttp_free(3)and reenter the parse loop. same drill, bestie.KCGI_SYSTEMβ internal system error writing to the output stream. the write said nope π
π EXAMPLES π
this one outputs a simple HTML page, main character energy. it assumes r is a struct kreq pointer. and for brevity it does no error checking whatsoever β iconic, reckless, we love it:
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_elem(&req, KELEM_P);
khtml_puts(&req, "Hello");
khtml_ncr(&req, KENTITY_hellip); /* ... */
khtml_close(&req);
(that /* ... */ is the actual entity doing its thing, not me being mysterious π§)
π¦ SEE ALSO π¦
β STANDARDS β
the referenced HTML5 standard is HTML5.2: https://www.w3.org/TR/html52 β go read it if you're feeling studious, bestie π
π AUTHORS π
written by Kristaps Dzonsons <kristaps@bsd.lv> π
ngl, this page is giving "short and sweet and does exactly one thing". obsessed. periodt. π
Debian Β· $Mdocdate$ Β· KHTML_ENTITY(3) β okay that's the whole page, love u, go write some HTML ππΈπ
π¦ 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