KCGI_BUF_PUTS(3)
π KCGI_BUF_PUTS(3) β it's giving "library functions manual" β¨
okay so bestie, welcome to the manual page for kcgi_buf_puts β a function from the libkcgi library (that's "library "libkcgi"" to be formal about it π). this one's short, sweet, and honestly kind of iconic. let's get into it π
πΈ NAME πΈ
kcgi_buf_puts β put string content into a kcgi buffer π«Ά
π LIBRARY π
the library is literally libkcgi, no cap β¨
π¦ SYNOPSIS π¦
#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>
#include <kcgi.h>
enum kcgi_err
kcgi_buf_puts(struct kcgi_buf *buf, const char *cp);
π DESCRIPTION π
okay so what it does: it appends a NUL-terminated string cp to a buffer buf. that's the whole vibe, honestly π
β IMPORTANT, bestie: buffers must be initialised to zero with memset(3) prior to first use. like, before you touch them. no exceptions, periodt π
the way this function handles things: it does nothing if cp is NULL (silent queen behavior, she just moves on π).
and heads up β it does not append a newline like puts(3) does. so don't come crying to me when your output is all crammed on one line, iykyk π
π₯ RETURN VALUES π₯
it returns an enum kcgi_err indicating the error state. here's the full lineup π
KCGI_OKβ success, we love to see it π (not an error, bestie, she's fine)KCGI_ENOMEMβ internal memory allocation failure π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 indicates thatkhttp_body(3)did not return with success or was not invoked. 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 π¨
β¨ EXAMPLES β¨
okay here's a cute little example π β it creates a simple NUL-terminated buffer and outputs its contents. note: it does not perform any error checking, so this is very "living in the moment" of it ngl π
struct kcgi_buf buf;
memset(&buf, 0, sizeof(struct kcgi_buf));
kcgi_buf_puts(&buf, "Hello, world!");
puts(buf.buf); /* Emits "Hello, world!" */
free(buf.buf);
and yes, she emits "Hello, world!" β iconic behavior, honestly ππ«
π SEE ALSO π
go read those next, bestie, they're all part of the same friend group π«Ά
π AUTHORS π
written by Kristaps Dzonsons <kristaps@bsd.lv> π β thank you for your service, king π«‘
and that's the page!! π this version came from Debian, dated $Mdocdate$, and it's the KCGI_BUF_PUTS(3) manual page β mwah, slay, bye bestie π
β¨π
π¦ 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