buffer_getnewline_sa(3)
π buffer_getnewline_sa(3) π
okay bestie, so this one lives in the Library Functions Manual and it's called buffer_getnewline_sa β say it with me, it's giving "grab me a line, queen". π
β¨ NAME β¨
buffer_getnewline_sa β read line from buffer
πΈ SYNTAX πΈ
#include <libowfat/stralloc.h>
#include <libowfat/buffer.h>
int buffer_getnewline_sa(buffer* b,stralloc* sa);
π¦ DESCRIPTION π¦
so what this icon actually does: buffer_getnewline_sa copies data from b over into sa, and it keeps going until it finds a '\n'. and here's the thing β it overwrites whatever was chilling in sa before, so don't get attached to the old contents, they're gone, periodt. π
and yes, that newline character itself also gets appended to sa. she comes with the line, she is part of the line. no cap.
if reading from the buffer fails, or if allocating memory fails, buffer_getnewline_sa returns -1 and sets errno appropriately. and at that point? sa may be empty, or it may already contain a partial token. so like, it's a vibe check that failed halfway through. π
ok important side note bestie β if you're trying to read from a non-blocking socket, use buffer_getline_sa instead. this one is not the girl for that job. π
π RETURN VALUE π
-1β on error (and she setserrno, she's thorough π)0β on EOF1β when successful π
π SEE ALSO π
and that's the whole page, bestie!! mwah π this was buffer_getnewline_sa(3) from the Library Functions Manual β go read a line, slay, and remember: overwriting is forever. π«Άβ¨π
π¦ 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