DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

keyname(3curses)


keyname -- get name of key

Synopsis

cc [options] file -lcurses
#include <curses.h>

char *keyname(int c);

char *key_name(wchar_t c);

Description

The keyname(3curses) and key_name(3curses) functions generate a character string whose value describes the key c. The c argument of keyname(3curses) can be an 8-bit character or a key code. The c argument of key_name(3curses) 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 only) KEY_name
None of the above UNKNOWN KEY

 +----------------------------------------------+---------------------------+
 |                    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  only) | KEY_name                  |
 +----------------------------------------------+---------------------------+
 |None of the above                             | UNKNOWN KEY               |
 +----------------------------------------------+---------------------------+

The meta-character notation shown above is used only if meta-characters are enabled.

Return value

Upon successful completion, keyname(3curses) returns a pointer to a string as described above. Otherwise, it returns a null pointer.

Errors

No errors are defined.

Usage

The return value of keyname(3curses) and key_name(3curses) 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(3curses) cannot detect meta-characters, since wide characters do not support meta-characters.

Standards Conformance

The Single UNIX Specification, Version 2; The Open Group.

References

meta(3curses), curses(4)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004