key_defined(3X) Library calls key_defined(3X)

key_defined - obtain key code for an ncurses function key definition

#include <curses.h>
int key_defined(const char * definition);

The key_defined ncurses extension permits a curses application to determine the function key code, if any, to which the string definition is bound.

key_defined returns the first key code to which definition is bound if any exists. If none does, it returns 0. If definition is a prefix of another bound definition, key_defined returns -1.

key_defined is an ncurses extension.

Applications employing ncurses extensions should condition their use on the visibility of the NCURSES_VERSION preprocessor macro.

Thomas Dickey

curses(3X), define_key(3X), keybound(3X), keyok(3X)

2025-10-04 ncurses 6.6