menu\_new(3X) Library calls menu\_new(3X)

# [NAME](#NAME)

**new\_menu**, **free\_menu** - create and destroy menus

# [SYNOPSIS](#SYNOPSIS)

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

```
MENU *new_menu(ITEM **items);
int free_menu(MENU *menu);
```

# [DESCRIPTION](#DESCRIPTION)

The function **new\_menu** creates a new menu connected to a specified item pointer array (which must be *NULL*-terminated).

The function **free\_menu** disconnects *menu* from its item array and frees the storage allocated for the menu.

# [RETURN VALUE](#RETURN_VALUE)

The function **new\_menu** returns *NULL* on error. It sets **errno** according to the function's failure:

[**E\_NOT\_CONNECTED**](#E_NOT_CONNECTED)

No items are connected to the menu.

[**E\_SYSTEM\_ERROR**](#E_SYSTEM_ERROR)

System error occurred, e.g., malloc failure.

The function **free\_menu** returns one of the following:

[**E\_OK**](#E_OK)

The routine succeeded.

[**E\_SYSTEM\_ERROR**](#E_SYSTEM_ERROR~2)

System error occurred (see [**errno**(3)](/man/os/ncurses/errno.3)).

[**E\_BAD\_ARGUMENT**](#E_BAD_ARGUMENT)

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

[**E\_POSTED**](#E_POSTED)

The menu has already been posted.

# [PORTABILITY](#PORTABILITY)

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

# [AUTHORS](#AUTHORS)

Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond.

# [SEE ALSO](#SEE_ALSO)

[**curses**(3X)](/man/os/ncurses/curses.3X), [**menu**(3X)](/man/os/ncurses/menu.3X)

2024-12-28 ncurses 6.6

---

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