KCGI_BUF_WRITE(3)
πΈ NAME πΈ
okay so this is KCGI_BUF_WRITE(3) from the Library Functions Manual, and itβs literally all about kcgi_buf_write β put binary data into a kcgi buffer π no cap, thatβs the whole name section.
π«Ά LIBRARY π«Ά
library βlibkcgiβ β thatβs the library line, bestie, and itβs giving main character energy β¨
π SYNOPSIS π
#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>
#include <kcgi.h>
enum kcgi_err
kcgi_buf_write(const char *buf, size_t sz, void *arg);
yes, thatβs the exact setup, iykyk π
π DESCRIPTION π
Appends binary data buf of size sz to arg, which is cast to a struct kcgi_buf *. Buffers must be initialised to zero with memset(3) prior to first use. The buffer will always be NUL-terminated. Does nothing if buf is NULL or sz is zero.
The struct kcgi_buf structure has the following fields:
char *bufβ Buffer contents. This is always NUL-terminated, even if the data is binary. This buffer must be passed tofree(3)after use.size_t maxszβ Allocated buffer size.size_t szβ Buffer current length not including the NUL terminator.size_t growszβ Amount of "slop" space in the buffer if it's reallocated. If set to zero, defaults to 1 KB.
π₯ RETURN VALUES π₯
These functions return an enum kcgi_err indicating the error state: KCGI_OK for no error, KCGI_ENOMEM for an internal memory allocation failure.
π EXAMPLES π
The following creates a simple NUL-terminated buffer. It does not perform any error checking.
struct kcgi_buf buf;
memset(&buf, 0, sizeof(struct kcgi_buf));
kcgi_buf_write("xyzzy", 5, &buf);
puts(buf.buf); /* Emits "xyzzy" */
free(buf.buf);
π¦ SEE ALSO π¦
π AUTHORS π
Written by Kristaps Dzonsons <kristaps@bsd.lv>.
source/version: Debian Β· date: $Mdocdate$ Β· page: KCGI_BUF_WRITE(3) β bye bestie, go slay those buffers π
π«Ά
π¦ where this page comes from
- alpine 3.24: kcgi-doc 1.0.1-r0 Β· ISC
- Copyright (c) 2018, 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