define_key(3x) define_key(3x)
define_key - define a keycode
- キーコードを定義する
#include <curses.h>
int define_key(const char *definition, int keycode);
This is an extension to the curses library. It permits an
application to define keycodes with their corresponding
control strings, so that the ncurses library will inter-
pret them just as it would the predefined codes in the
terminfo database.
これは curses ライブラリに対する拡張機能です。
これを使うと、対応する制御文字列とともにキーコードを
定義することができ、 ncurses ライブラリはそれを
terminfo データベースで定義済みのコードと同様に解釈します。
If the given string is null, any existing definition for
the keycode is removed. Similarly, if the given keycode
is negative or zero, any existing string for the given
definition is removed.
与えられた文字列がヌルならば、そのキーコードに対して存在する
すべての定義は削除されます。
同様に、与えられたキーコードが負またはゼロならば、
与えられた定義に対して存在するすべての文字列は削除されます。
The keycode must be greater than zero, and the string non-
null, otherwise ERR is returned. ERR may also be returned
if there is insufficient memory to allocate the data to
store the definition. If no error is detected, OK is
returned.
キーコードはゼロより大きくなければならず、文字列は
ヌルであってはならず、それ以外のとき、ERR を返します。
(訳注: 説明後半と整合するのか不明)
また、定義を格納するためのデータ領域を割り当てるために
十分なメモリがない場合にも ERR を返します。
エラーを検出しなかったとき、OK を返します。
These routines are specific to ncurses. They were not
supported on Version 7, BSD or System V implementations.
It is recommended that any code depending on them be con-
ditioned using NCURSES_VERSION.
このルーチンは ncurses 特有です。
Version 7, BSD, System V の実装ではサポートされていません。
このルーチンに依存するすべてのコードは、NCURSES_VERSION を
使って条件付きとすることを推奨します。
keyok(3x), key_defined(3x).
Thomas Dickey.
define_key(3x)