TERMKEY_INTERPRET_STRING(3)

NAME
termkey_interpret_string - fetch stored control string

SYNOPSIS
#include <termkey.h>

TermKeyResult termkey_interpret_string(TermKey *tk, const TermKeyKey *key,
    const char **strp);

Link with -ltermkey.

DESCRIPTION
termkey_interpret_string() fetches the string stored in the TermKey instance from the most recently received TERMKEY_TYPE_DCS or TERMKEY_TYPE_OSC event. Note that it is important to call this function as soon as possible after obtaining a one of these string key event; specifically, before calling termkey_getkey() or termkey_waitkey() again, as a subsequent call will overwrite the buffer space currently containing this string.

The string pointer whose address is given by strp will be set to point at the actual stored string in the instance. The caller is free to read this string (which will be correctly NUL-terminated), but should not modify it. It is not necessary to free() the pointer; the containing TermKey instance will do that.

RETURN VALUE
If passed the most recent key event of the type TERMKEY_TYPE_DCS or TERMKEY_TYPE_OSC, this function will return TERMKEY_RES_KEY and will affect the variables whose pointers were passed in, as described above.

For other event types, or stale events, it will return TERMKEY_RES_NONE, and its effects on any variables whose pointers were passed in are undefined.

SEE ALSO
termkey_waitkey(3), termkey_getkey(3), termkey(7)