TERMKEY_PUSH_BYTES(3)
π TERMKEY_PUSH_BYTES π
okay bestie, welcome to the Library Functions Manual β¨ this is TERMKEY_PUSH_BYTES(3) and she is lowkey the plug for feeding bytes into your termkey instance π«Ά
πΈ NAME πΈ
termkey_push_bytes β supply more bytes to the input buffer π
β¨ SYNOPSIS β¨
#include <termkey.h>
size_t termkey_push_bytes(TermKey *tk, const char *bytes, size_t len);
Link with -ltermkey.
π¦ DESCRIPTION π¦
so termkey_push_bytes() lets you yeet more bytes of input directly into the input buffer of your termkey(7) instance π no middleman, no drama, just bytes going straight in.
but fr fr, if there was no buffer space remaining, then-1gets returned witherrnoset toENOMEMπ the buffer said "I'm full bestie" and honestly? respect.
this function, hanging out with termkey_getkey(3), is literally what makes it possible to use the termkey instance with a source of bytes other than reading a filehandle π it's giving flexible, it's giving versatile.
for synchronous usage, termkey_waitkey(3) is the one doing the input blocking task π
she blocks, she waits, she serves.
and for use against a regular stream filehandle that supports read(2), go check termkey_advisereadable(3) π different vibe, same energy.
π RETURN VALUE π
termkey_push_bytes() returns the number of bytes consumed from the input β and ngl, that number may be smaller than the length provided, if the buffer runs out of space π β or -1 cast to size_t if an error occurs, in which case errno is set accordingly.
not me returning-1cast tosize_tπ that's the cursed-but-canonical way and we respect the bit.
π SEE ALSO π
sign-off time π this whole thing lives in the Library Functions Manual, under the name TERMKEY_PUSH_BYTES(3), and the footer said TERMKEY_PUSH_BYTES(3) too β periodt π go push some bytes, bestie, you got this π¦β¨
π¦ where this page comes from
- alpine 3.24: libtermkey-doc 0.22-r4 Β· MIT
- debian trixie: libtermkey-dev 0.22-2+b1 Β· MIT
- epel 10: libtermkey-devel 0.22-2.el10_0 Β· MIT
- epel 9: libtermkey-devel 0.22-2.el9 Β· MIT
- fedora 43: libtermkey-devel 0.22-11.fc43 Β· MIT
- fedora 43: libtermkey-devel 0.22-11.fc43 Β· MIT
- fedora 44: libtermkey-devel 0.22-12.fc44 Β· MIT
- fedora 44: libtermkey-devel 0.22-12.fc44 Β· MIT
- nixos 26.05: libtermkey 0.22
- nixpkgs unstable: libtermkey 0.22
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- ubuntu questing: libtermkey-dev 0.22-2
- ubuntu resolute: libtermkey-dev 0.22-2build1 Β· MIT
- ubuntu stonking: libtermkey-dev 0.22-3 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms