buffer_getline_sa(3)
π buffer_getline_sa β the manual, but make it make sense
okay bestie, welcome to section 3 of the Library Functions Manual π this is buffer_getline_sa(3), and yes she's a libowfat girlie β¨
πΈ NAME πΈ
buffer_getline_sa β read a line from a buffer. that's it, that's the whole job description π
β¨ SYNTAX β¨
#include <libowfat/stralloc.h>
#include <libowfat/buffer.h>
int buffer_getline_sa(buffer* b,stralloc* sa);
two includes, one function, zero drama π«Ά
π¦ DESCRIPTION π¦
so here's the tea, bestie: buffer_getline_sa takes data from b and appends it to sa until it hits a '\n'. note the word appends β she does NOT overwrite the previous content of sa, okay? the old stuff stays. and the new-line itself? also gets appended to sa. iconic behaviour honestly π
now for the part where we gotta be real: if reading from the buffer fails, or if allocating memory fails, buffer_getline_sa returns -1 and sets errno appropriately π and at that exact moment, sa may be empty, or it may already contain a partial token. yeah. partial. like it stopped mid-vibe. so watch out for that π
β RETURN VALUE β
-1on error β and she setserrnowhile she's at it, no cap0on EOF1when successful π
three possible outcomes, zero mystery π
π RATIONALE π
why does she append instead of overwriting? because bestie, that's what makes her usable on non-blocking sockets π₯
those sockets signal error and set errno to EAGAIN, and when that happens you don't panic β you literally just call buffer_getline_sa again later, once select or poll tell you more data is available. main character energy: she waits for her moment and then she comes back π
β¨
π SEE ALSO π
go read your sisters, they're just as iconic π¦
no cap: on error, sa might be empty or hold a partial token. plan accordingly, bestie π
and that's the whole page!! brought to you by the Library Functions Manual, filed under buffer_getline_sa(3) in section 3 π mwah, go read a buffer, periodt π
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms