buffer_get_token(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– buffer_get_token(3) πŸ’–

okay bestie, welcome to the Library Functions Manual β€” today's main character is buffer_get_token, and she is literally the token-grabbing queen πŸ‘‘βœ¨


🌸 NAME 🌸

buffer_get_token β€” read token from buffer πŸŽ€


✨ SYNTAX ✨

#include <libowfat/buffer.h>

ssize_t buffer_get_token(buffer* b,char* x,size_t len,
                 const char* charset,size_t setlen);

like. she's giving five arguments and zero apologies πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the vibe 🫢 β€” buffer_get_token copies data from b over into x[0], x[1], ..., x[len-1], and she keeps going until either:

  • len bytes have been copied, or
  • one of charset[0], charset[1], ..., charset[setlen] equals the last byte that was read πŸ”₯

basically she's slurping bytes until she hits a character you told her is a stopping point, or until the destination is full. no cap.

then she returns the number of bytes read πŸ“ β€” or -1 on error, and when that happens she sets errno appropriately, because she's messy but she's accountable πŸ˜­πŸ’€


πŸ‘€ SEE ALSO πŸ‘€

go read those too, they're all part of the same friend group fr fr 🧚


and that's the whole page, bestie 🌈 this lil cutie came from the Library Functions Manual, and she goes by buffer_get_token(3) β€” periodt πŸ’–βœ¨πŸŽ€