TERMKEY_INTERPRET_STRING(3)
π TERMKEY_INTERPRET_STRING(3) π
okay bestie, welcome to the Library Functions Manual β¨ this one's short and sweet, no cap.
πΈ NAME πΈ
termkey_interpret_string β fetch that stored control string, periodt π
π¦ SYNOPSIS π¦
#include <termkey.h>
TermKeyResult termkey_interpret_string(TermKey *tk, const TermKeyKey *key,
const char **strp);
Link with -ltermkey.
β¨ DESCRIPTION β¨
so here's the tea π β termkey_interpret_string() goes and grabs the string that's chillin' inside your TermKey instance, the one from the most recently received TERMKEY_TYPE_DCS or TERMKEY_TYPE_OSC event. that's the whole vibe.
but listen, this is the important part, i need you paying attention π β you gotta call this function ASAP after you get one of those string key events. like, immediately. specifically before you call termkey_getkey() or termkey_waitkey() again, because a subsequent call will overwrite the buffer space that's currently holding your string. your cute little string? gone. evaporated. it's giving expired π
so the string pointer, whose address you hand over in strp, gets set to point at the actual stored string inside the instance. the caller (that's you, bestie π«Ά) is free to read that string β and yes it will be correctly NUL-terminated, we're not animals β but do NOT modify it. hands off. look with your eyes π
also you do not need to free() that pointer. put the malloc away. the containing TermKey instance handles all of that itself, it's very much the main character doing its own admin π
π RETURN VALUE π
if you pass it the most recent key event of type TERMKEY_TYPE_DCS or TERMKEY_TYPE_OSC, this function returns TERMKEY_RES_KEY and it will affect the variables whose pointers you passed in, exactly as described above. slay β¨
for other event types, or for stale events? it returns TERMKEY_RES_NONE, and its effects on any of those pointer variables are undefined. not "maybe", not "probably fine" β undefined. so don't go reading them and acting surprised, i warned you π
π SEE ALSO π
and that's the whole page, no notes π this was the TERMKEY_INTERPRET_STRING(3) page from the Library Functions Manual β go forth and interpret your strings before the buffer eats them, i'm obsessed with you, bye ππ¦
π¦ 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