menu(3X)

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

okay so bestie, this is menu(3X) from the library calls girlies, and she's basically the blueprint for putting cute little menus on your terminal. no cap, she's iconic. let's get into it 🫢


🌸 NAME 🌸

menu β€” present menus in curses windows πŸ’–


✨ SYNOPSIS ✨

#include <menu.h>

πŸŽ€ DESCRIPTION πŸŽ€

The menu library is literally giving terminal-independent facilities for composing menu systems on character-cell terminals. iykyk β€” it doesn't care what terminal you're on, it just slays.

The library includes two whole friend groups:

  • item routines β€” these create and modify menu items πŸ“
  • menu routines β€” these 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. no skipping steps bestie, it's not that kind of party πŸ™ˆ

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. read that again, it's giving "no retroactive edits" energy πŸ’€

πŸ¦‹ Routine Name Index

The following table lists each menu routine and the name of the manual page on which it is described. (the original was a table, we're doing a glow-up list, but every single one is here, periodt ✨)

  • current_item β€” mitem_current(3X)
  • free_item β€” mitem_new(3X)
  • free_menu β€” menu_new(3X)
  • item_count β€” menu_items(3X)
  • item_description β€” mitem_name(3X)
  • item_index β€” mitem_current(3X)
  • item_init β€” menu_hook(3X)
  • item_name β€” mitem_name(3X)
  • item_opts β€” mitem_opts(3X)
  • item_opts_off β€” mitem_opts(3X)
  • item_opts_on β€” mitem_opts(3X)
  • item_term β€” menu_hook(3X)
  • item_userptr β€” mitem_userptr(3X)
  • item_value β€” mitem_value(3X)
  • item_visible β€” mitem_visible(3X)
  • menu_back β€” menu_attributes(3X)
  • menu_driver β€” menu_driver(3X)
  • menu_fore β€” menu_attributes(3X)
  • menu_format β€” menu_format(3X)
  • menu_grey β€” menu_attributes(3X)
  • menu_init β€” menu_hook(3X)
  • menu_items β€” menu_items(3X)
  • menu_mark β€” menu_mark(3X)
  • menu_opts β€” menu_opts(3X)
  • menu_opts_off β€” menu_opts(3X)
  • menu_opts_on β€” menu_opts(3X)
  • menu_pad β€” menu_attributes(3X)
  • menu_pattern β€” menu_pattern(3X)
  • menu_request_by_name β€” menu_requestname(3X)
  • menu_request_name β€” menu_requestname(3X)
  • menu_spacing β€” menu_spacing(3X)
  • menu_sub β€” menu_win(3X)
  • menu_term β€” menu_hook(3X)
  • menu_userptr β€” menu_userptr(3X)
  • menu_win β€” menu_win(3X)
  • new_item β€” mitem_new(3X)
  • new_menu β€” menu_new(3X)
  • pos_menu_cursor β€” menu_cursor(3X)
  • post_menu β€” menu_post(3X)
  • scale_menu β€” menu_win(3X)
  • set_current_item β€” mitem_current(3X)
  • set_item_init β€” menu_hook(3X)
  • set_item_opts β€” mitem_opts(3X)
  • set_item_term β€” menu_hook(3X)
  • set_item_userptr β€” mitem_userptr(3X)
  • set_item_value β€” mitem_value(3X)
  • set_menu_back β€” menu_attributes(3X)
  • set_menu_fore β€” menu_attributes(3X)
  • set_menu_format β€” menu_format(3X)
  • set_menu_grey β€” menu_attributes(3X)
  • set_menu_init β€” menu_hook(3X)
  • set_menu_items β€” menu_items(3X)
  • set_menu_mark β€” menu_mark(3X)
  • set_menu_opts β€” mitem_opts(3X)
  • set_menu_pad β€” menu_attributes(3X)
  • set_menu_pattern β€” menu_pattern(3X)
  • set_menu_spacing β€” menu_spacing(3X)
  • set_menu_sub β€” menu_win(3X)
  • set_menu_term β€” menu_hook(3X)
  • set_menu_userptr β€” menu_userptr(3X)
  • set_menu_win β€” menu_win(3X)
  • set_top_row β€” mitem_current(3X)
  • top_row β€” mitem_current(3X)
  • unpost_menu β€” menu_post(3X)

πŸ”₯ RETURN VALUE πŸ”₯

Routines that return pointers return NULL on error. that's the classic "it's not me, it's the error" 😭

Routines that return an integer return one of the following error codes:

  • E_OK β€” The routine succeeded. slay πŸ’…
  • 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. rude but okay πŸ™„
  • 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)).
  • 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. it's giving "she comes with friends" πŸ’œ


🌈 PORTABILITY 🌈

These routines emulate the System V menu library. They were not supported on Version 7 or BSD versions. so if you're on ancient vibes, no menu for you bestie πŸ’€

A menu facility was documented in SVr4.2's Character User Interface Programming document. iconic documentation behavior ✨

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. legends, fr fr 🫢


⭐ SEE ALSO ⭐

curses(3X) and related pages whose names begin β€œmenu_” for detailed descriptions of the entry points.


okay that's the whole page, no skips, no cap πŸ’– and before you go β€” this little masterpiece is from ncurses 6.5, dated 2025-11-11, still serving menu(3X) realness to this very day πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from