[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Converting extended terminof capabilites to keycode
From: |
Thomas Dickey |
Subject: |
Re: Converting extended terminof capabilites to keycode |
Date: |
Sun, 24 Jan 2016 18:19:02 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sun, Jan 24, 2016 at 09:45:51AM +0100, Thomas Beierlein wrote:
> Hi all,
>
> I am looking for a portable way to determine the key code for an
> extended capability entry in the terminfo base. I am especially
> interested in a lookup for CTRL/Alt-PgUp/PgDn combinations (kNXT5/kNXT3
> and kPRV5/kPRV3).
>
> What I found so far is to lookup the key ESC-sequence by e.g.
> char *name = tigetstr("kNXT3");
> and later check with
> int code = key_defined(name);
> if the sequence is defined and getting the associated key code as an
> side effect.
>
> I would like to know if there is a more direct way to ask for the key
> code associated with the capability name. Any help is welcome.
no - that's correct. A function which combined the two might look like
int
keycode_of(const char *name)
{
int code = ERR;
char *value;
value = tigetstr(name);
if (value != 0 && value != (char *)(-1)) {
code = key_defined(value);
}
return code;
}
--
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net
signature.asc
Description: Digital signature