---
name: "menu_new"
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/free_menu"
---

# menu\_new(3)

create and destroy menus

Part of [free\_menu(3)](/free_menu/3.md).

## NAME

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

## SYNOPSIS

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

**MENU \*new\_menu(ITEM \*\****items***);** **int free\_menu(MENU \****menu***);**

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

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

- **E\_NOT\_CONNECTED**

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

- **E\_SYSTEM\_ERROR**

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

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

- **E\_OK**

  **The routine succeeded.**

- **E\_SYSTEM\_ERROR**

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

- **E\_BAD\_ARGUMENT**

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

- **E\_POSTED**

  **The menu has already been posted.**

## PORTABILITY

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

## AUTHORS

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

## SEE ALSO

**curses(3X),** **menu(3X)**
