---
name: "menu"
section: "3menu"
platform: "linux"
package: "ncurses-doc"
version: "6.5+20250216-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/menu/3menu"
---

# menu(3menu)

present menus in curses windows

## NAME

**menu** - present menus in *curses* windows

## SYNOPSIS

```
#include <menu.h>
```

## DESCRIPTION

**The menu library provides terminal-independent facilities for composing** **menu systems on character-cell terminals.** **The library includes: item routines,** **which create and modify menu items; and menu routines, which group items into** **menus, display menus on the screen, and handle interaction with the user.**

**The menu library uses the curses libraries, and a curses** **initialization routine such as initscr must be called before using any of** **these functions.** **To use the menu library, link with the options** **-lmenu -lcurses.**

### Current Default Values for Item Attributes

**The menu library maintains a default value for item attributes.** **You can** **get or set this default by calling the appropriate get\_ or set\_** **routine with a** *NULL* **item pointer.** **Changing this default with a** **set\_ function affects future item creations, but does not change the** **rendering of items already created.**

### Routine Name Index

**The following table lists each menu routine and the name of** **the manual page on which it is described.**

| | |
| --- | --- |
| **curses** Routine Name | Manual Page Name |
| current\_item | **menu\_current**(3MENU) |
| free\_item | **menu\_new**(3MENU) |
| free\_menu | **new**(3MENU) |
| item\_count | **items**(3MENU) |
| item\_description | **menu\_name**(3MENU) |
| item\_index | **menu\_current**(3MENU) |
| item\_init | **hook**(3MENU) |
| item\_name | **menu\_name**(3MENU) |
| item\_opts | **menu\_opts**(3MENU) |
| item\_opts\_off | **menu\_opts**(3MENU) |
| item\_opts\_on | **menu\_opts**(3MENU) |
| item\_term | **hook**(3MENU) |
| item\_userptr | **menu\_userptr**(3MENU) |
| item\_value | **menu\_value**(3MENU) |
| item\_visible | **menu\_visible**(3MENU) |
| menu\_back | **attributes**(3MENU) |
| menu\_driver | **driver**(3MENU) |
| menu\_fore | **attributes**(3MENU) |
| menu\_format | **format**(3MENU) |
| menu\_grey | **attributes**(3MENU) |
| menu\_init | **hook**(3MENU) |
| menu\_items | **items**(3MENU) |
| menu\_mark | **mark**(3MENU) |
| menu\_opts | **opts**(3MENU) |
| menu\_opts\_off | **opts**(3MENU) |
| menu\_opts\_on | **opts**(3MENU) |
| menu\_pad | **attributes**(3MENU) |
| menu\_pattern | **pattern**(3MENU) |
| menu\_request\_by\_name | **requestname**(3MENU) |
| menu\_request\_name | **requestname**(3MENU) |
| menu\_spacing | **spacing**(3MENU) |
| menu\_sub | **win**(3MENU) |
| menu\_term | **hook**(3MENU) |
| menu\_userptr | **userptr**(3MENU) |
| menu\_win | **win**(3MENU) |
| new\_item | **menu\_new**(3MENU) |
| new\_menu | **new**(3MENU) |
| pos\_menu\_cursor | **cursor**(3MENU) |
| post\_menu | **post**(3MENU) |
| scale\_menu | **win**(3MENU) |
| set\_current\_item | **menu\_current**(3MENU) |
| set\_item\_init | **hook**(3MENU) |
| set\_item\_opts | **menu\_opts**(3MENU) |
| set\_item\_term | **hook**(3MENU) |
| set\_item\_userptr | **menu\_userptr**(3MENU) |
| set\_item\_value | **menu\_value**(3MENU) |
| set\_menu\_back | **attributes**(3MENU) |
| set\_menu\_fore | **attributes**(3MENU) |
| set\_menu\_format | **format**(3MENU) |
| set\_menu\_grey | **attributes**(3MENU) |
| set\_menu\_init | **hook**(3MENU) |
| set\_menu\_items | **items**(3MENU) |
| set\_menu\_mark | **mark**(3MENU) |
| set\_menu\_opts | **menu\_opts**(3MENU) |
| set\_menu\_pad | **attributes**(3MENU) |
| set\_menu\_pattern | **pattern**(3MENU) |
| set\_menu\_spacing | **spacing**(3MENU) |
| set\_menu\_sub | **win**(3MENU) |
| set\_menu\_term | **hook**(3MENU) |
| set\_menu\_userptr | **userptr**(3MENU) |
| set\_menu\_win | **win**(3MENU) |
| set\_top\_row | **menu\_current**(3MENU) |
| top\_row | **menu\_current**(3MENU) |
| unpost\_menu | **post**(3MENU) |

## RETURN VALUE

**Routines that return pointers return** *NULL* **on error.** **Routines that return** **an integer return one of the following error codes:**

- **E\_OK**

  **The routine succeeded.**

- **E\_BAD\_ARGUMENT**

  **Routine detected an incorrect or out-of-range argument.**

- **E\_BAD\_STATE**

  **Routine was called from an initialization or termination function.**

- **E\_NO\_MATCH**

  **Character failed to match.**

- **E\_NO\_ROOM**

  **Menu is too large for its window.**

- **E\_NOT\_CONNECTED**

  **No items are connected to the menu.**

- **E\_NOT\_POSTED**

  **The menu has not been posted.**

- **E\_NOT\_SELECTABLE**

  **The designated item cannot be selected.**

- **E\_POSTED**

  **The menu is already posted.**

- **E\_REQUEST\_DENIED**

  **The menu driver could not process the request.**

- **E\_SYSTEM\_ERROR**

  **System error occurred (see [errno(3)](/errno/3.md)).**

- **E\_UNKNOWN\_COMMAND**

  **The menu driver code saw an unknown request code.**

## NOTES

**The header file** *menu.h* **itself includes the header file** *curses.h***.**

## PORTABILITY

**These routines emulate the System V menu library.** **They were not supported on** **Version 7 or BSD versions.**

**A menu facility was documented in SVr4.2's** *Character User Interface Programming* **document.**

**It is not part of X/Open Curses.**

**Aside from** *ncurses***, there are few implementations:**

- •

  **systems based on SVr4 source code, e.g., Solaris.**

- •

  **NetBSD curses.**

## AUTHORS

**Juergen Pfeifer.** **Manual pages and adaptation for** *ncurses* **by Eric S. Raymond.**

## SEE ALSO

**ncurses(3NCURSES) and related pages whose names begin “menu\_”** **for detailed descriptions of the entry points.**
