TERMKEY_LOOKUP_KEYNAME(3)
π NAME π
termkey_lookup_keyname β bestie, this is the one that looks up a symbolic key value for a string name π
β¨ SYNOPSIS β¨
#include <termkey.h>
char *termkey_lookup_keyname(TermKey *tk, const char *keyname,
TermKeySym *sym);
Link with -ltermkey.
πΈ DESCRIPTION πΈ
okay so termkey_lookup_keyname() takes a string name and goes looking for the symbolic key value it represents, no cap. And heads up β this comparison is case-sensitive, so don't come at it with your chaotic lowercase energy and expect it to match.
The symbolic value it finds gets written into the variable that sym is addressing. π
The way this works is it's a glow-up of termkey_keyname2sym(3) β like, a more general form of it, because it can spot a symbolic key name sitting inside a longer string and hand you back a pointer to the rest of the input that comes after the key name. main character behavior honestly.
β οΈ lowkey important: because the key names are stored in an array that's indexed by the symbol number, this function has to do a linear search of the names. so like, not fast bestie. π
The way that you should use this is: keep it restricted to converting key names into symbolic values during your program's initialisation, so that while the program is actually running you can do efficient comparisons instead. efficiency era π§β¨
π RETURN VALUE π
termkey_lookup_keyname() returns a pointer to the first character after a recognised name β like, right where the key name ends and the rest begins. π«Ά
But if the string does not begin with the name of a recognised symbolic key, you get NULL. not a single match, nothing, ghosted π
π¦ SEE ALSO π¦
and that's the whole page, bestie π this one lives in the Library Functions Manual under TERMKEY_LOOKUP_KEYNAME(3) β periodt, go read it, ily, mwah πβ¨
π¦ 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