key\_defined(3X) Library calls key\_defined(3X)

# [NAME](#NAME)

**key\_defined** - obtain key code for an *ncurses* function key definition

# [SYNOPSIS](#SYNOPSIS)

```
#include <curses.h>
```

```
int key_defined(const char * definition);
```

# [DESCRIPTION](#DESCRIPTION)

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

# [RETURN VALUE](#RETURN_VALUE)

**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**.

# [EXTENSIONS](#EXTENSIONS)

**key\_defined** is an *ncurses* extension.

# [PORTABILITY](#PORTABILITY)

Applications employing *ncurses* extensions should condition their use on the visibility of the **NCURSES\_VERSION** preprocessor macro.

# [AUTHORS](#AUTHORS)

Thomas Dickey

# [SEE ALSO](#SEE_ALSO)

[**curses**(3X)](/man/os/ncurses/curses.3X), [**define\_key**(3X)](/man/os/ncurses/define_key.3X), [**keybound**(3X)](/man/os/ncurses/keybound.3X), [**keyok**(3X)](/man/os/ncurses/keyok.3X)

2025-10-04 ncurses 6.6

---

Document: key_defined(3x) from ncurses 6.6.20260926-r0 (Chainguard OS)
Source: https://github.com/ThomasDickey/ncurses-snapshots
