keyok(3X) Library calls keyok(3X)

# [NAME](#NAME)

**keyok** - enable or disable an *ncurses* function key code

# [SYNOPSIS](#SYNOPSIS)

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

```
int keyok(int key-code, bool bf);
```

# [DESCRIPTION](#DESCRIPTION)

The **keyok** *ncurses* extension permits a *curses* application to disable a function key *key-code* returned by [**wgetch**(3X)](/man/os/ncurses/wgetch.3X) (wide-character API users: [**wget\_wch**(3X)](/man/os/ncurses/wget_wch.3X)). Key codes that have been disabled can be re-enabled. *bf* selects the desired enablement status. This operation is more fine-grained than calling [**keypad**(3X)](/man/os/ncurses/keypad.3X), which affects *all* function keys.

# [RETURN VALUE](#RETURN_VALUE)

**keyok** returns **ERR** if

- *key-code* is nonpositive,
- *key-code* is not a recognized value, or
- enablement of *key-code* is already in the desired state.

Otherwise, **keyok** returns **OK**.

# [EXTENSIONS](#EXTENSIONS)

**keyok** is an *ncurses* extension.

# [PORTABILITY](#PORTABILITY)

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

NetBSD *curses* since 2.0 (2004) supports *keyok*.

# [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), [**key\_defined**(3X)](/man/os/ncurses/key_defined.3X)

2025-10-04 ncurses 6.6

---

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