menu_new(3X)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

okay so you're in the Library calls aisle of the manual, bestie, and this page is all about new_menu and free_menu β€” the create-and-destroy duo for menus. periodt. ✨


🌸 NAME 🌸

new_menu, free_menu β€” create and destroy menus πŸŽ€


✨ SYNOPSIS ✨

#include <menu.h>

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

πŸ¦‹ DESCRIPTION πŸ¦‹

So new_menu creates a fresh new menu connected to a specified item pointer array β€” and bestie, that array must be NULL-terminated. no cap, that part matters. πŸ’–

🚨 vibe check: the item pointer array has to be NULL-terminated, fr fr.

Then free_menu disconnects menu from its item array and frees the storage that was allocated for the menu. it's giving cleanup era. 🧹✨


πŸ’… RETURN VALUE πŸ’…

new_menu returns NULL on error. it sets errno according to the function's failure, like this:

  • 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 these:

  • E_OK β€” the routine succeeded. slay. πŸ‘‘
  • E_SYSTEM_ERROR β€” system error occurred (see errno(3)). 🫠
  • 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. iykyk. 🧚


πŸ’œ AUTHORS πŸ’œ

Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. iconic work, honestly. 🫢


⭐ SEE ALSO ⭐

  • curses(3X)
  • menu(3X)

πŸ’– that's the whole page, bestie β€” brought to you by ncurses 6.5, dated 2024-12-28, and signed menu_new(3X) ✨

πŸ“¦ where this page comes from