keyname(3X) keyname(3X)
NAME
keyname, keyname - get name of key
SYNOPSIS
cc [flag ...] file ... -lcurses [library ...]
#include <curses.h>
char *keyname(int c);
char *keyname(wchart c);
DESCRIPTION
The keyname() and keyname() functions generate a character string
whose value describes the key c. The c argument of keyname() can be an
8-bit character or a key code. The c argument of keyname() must be a
wide character.
The string has a format according to the first applicable row in the
following table:
______________________________________________________________
| Input Format of Returned String |
|_____________________________________________________________|
| Visible character The same character |
| Control character ^X |
| Meta-character (keyname() only) M-X |
| Key value defined in <curses.h> KEYname |
| (keyname() only) |
| None of the above UNKNOWN KEY |
|_____________________________________________________________|
The meta-character notation shown above is used only if meta-charac-
ters are enabled.
RETURN VALUE
Upon successful completion, keyname() returns a pointer to a string as
described above. Otherwise, it returns a null pointer.
ERRORS
No errors are defined.
NOTES
The return value of keyname() and keyname() may point to a static
area which is overwritten by a subsequent call to either of these
functions.
Applications normally process meta-characters without storing them
into a window. If an application stores meta-characters in a window
and tries to retrieve them as wide characters, keyname() cannot detect
meta-characters, since wide characters do not support meta-characters.
Page 1 Reliant UNIX 5.44 Printed 11/98
keyname(3X) keyname(3X)
SEE ALSO
curses(3X), meta(3X), curses(5).
Page 2 Reliant UNIX 5.44 Printed 11/98