buffer_get_new_token_sa(3)
β¨ buffer_get_new_token_sa β¨
okay bestie, come sit with me because we're doing libowfat tokens today and honestly? it's giving main character energy π
this page lives in the Library Functions Manual (that's the manual name, iykyk), and the whole thing is literally just: read a token out of a buffer. that's it. that's the vibe. π
πΈ NAME πΈ
buffer_get_new_token_sa β read token from buffer
like. it reads a token. from a buffer. no cap. π¦
β¨ SYNTAX β¨
#include <libowfat/stralloc.h>
#include <libowfat/buffer.h>
int buffer_get_new_token_sa(buffer* b,stralloc* sa,
const char* charset,size_t setlen);
so you got your b (the buffer, the source of the tea), your sa (the stralloc, where the token lands), your charset (the delimiter squad), and your setlen (how many delimiters are actually in that squad). π«Ά
π DESCRIPTION π
okay so here's the whole plot: buffer_get_new_token_sa copies data from the b over to sa until it bumps into one of the delimiters in charset. and the way it does this? it overwrites whatever was already chilling in sa before. not appending, not merging, not "aww let me preserve your old data" β full overwrite, periodt. π
and the delimiter that stopped the party? yeah, that one gets copied to sa too. it's part of the token now. iconic behavior honestly. β¨
π now the sad part: if reading from the buffer fails, or if allocating memory fails,buffer_get_new_token_sareturns-1and setserrnoappropriately. and listen β at that pointsamay already contain a partial token. so like, don't be out here trustingsaafter an error, bestie. it's half-baked. π
also, real talk: if you're trying to read from a non-blocking socket, use buffer_get_token_sa instead. this one is not the one for that job. different function, different vibe. π§
π₯ RETURN VALUE π₯
-1β error, and it's settingerrnoon the way out. π0β EOF. that's the end of the road, babe. π1β successful. slay. we ate. π
β SEE ALSO β
go read these next, they're all in the same friend group:
and that's the whole page, bestie!! π no source version, no date stamp, nothing extra β the footer just echoes buffer_get_new_token_sa(3) right back at us from the Library Functions Manual like a lil mirror. cute. obsessed. go read your tokens. πβ¨
π¦ 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