TERMKEY_IN...MODEREPORT(3)

πŸ’… termkey_interpret_modereport β€” bestie, let's decode that mode report ✨

okay so real talk, this is termkey_interpret_modereport(3) from the Library Functions Manual and she is exactly what you need when your terminal sends you one of those mysterious little mode reports and you're like "girl what does this even mean" 😭


πŸ¦‹ NAME πŸ¦‹

termkey_interpret_modereport β€” interpret opaque mode report data

like, it takes the cryptic vibes and turns them into actual numbers. main character energy fr fr πŸ’–


✨ SYNOPSIS ✨

#include <termkey.h>

TermKeyResult termkey_interpret_modereport(TermKey *tk, const TermKeyKey *key,
    int *initial, int *mode, int *value);

Link with -ltermkey.

bestie do NOT forget that -ltermkey at link time or she will simply not exist, and that is not the slay we're going for πŸ’€

πŸŽ€ DESCRIPTION πŸŽ€

so here's the tea πŸ“ β€” termkey_interpret_modereport() fills in variables in the passed pointers according to the mode report event found in key. you call her when termkey_getkey(3) or similar have returned a key event with the type of TERMKEY_TYPE_MODEREPORT. that's your green flag, that's your sign, that's your moment 🌈

any pointer may instead be given as NULL to not return that value. lowkey iconic, honestly β€” you get to pick and choose which ones you care about and just yeet the rest 🫢

now for the actual contents, periodt:

  • the initial variable will be filled with 0 for an ANSI mode report, or '?' for a DEC mode report πŸ‘‘
  • the mode variable will be filled with the number of the mode πŸ”₯
  • and value will be filled with the value from the report ⭐

three little boxes, three little answers, absolutely ate πŸ’…


πŸ’– RETURN VALUE πŸ’–

if you pass her a key event of the type TERMKEY_TYPE_MODEREPORT, this function will return TERMKEY_RES_KEY and will affect the variables whose pointers were passed in, as described above. she said "yes and here's your data" ✨

for other event types it will return TERMKEY_RES_NONE, and its effects on any variables whose pointers were passed in, are undefined. 🚨

okay important bestie: if you hand her the wrong event type, she returns TERMKEY_RES_NONE and whatever happens to those pointers after that is genuinely undefined. no promises, no guarantees, no vibes. do not go poking at those variables and expecting answers. that is a mystery box and we do not open mystery boxes πŸ™ˆ

🌸 SEE ALSO 🌸

go read those too, iykyk, they're the whole friend group 🧚


and that's the whole page, no cap πŸ’œ β€” this was TERMKEY_IN...MODEREPORT(3) from the Library Functions Manual, and yes the title really is spelled with that little ... in the middle, that's just her name and we respect it 🌈 stay hydrated, read your manpages, and remember: NULL is always an option 😌✨