---
name: "keyok"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/keyok"
---

# keyok(3)

enable or disable an ncurses function key code

## NAME

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

## SYNOPSIS

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

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

## DESCRIPTION

**The** **keyok** *ncurses* **extension permits a** *curses* **application to disable a function key** *key-code* **returned by wgetch(3X)** **(wide-character API users:** **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),** **which affects** *all* **function keys.**

## 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

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

## 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

**Thomas Dickey**

## SEE ALSO

**curses(3X),** **define\_key(3X),** **keybound(3X),** **keyok(3X),** **key\_defined(3X)**
