menu(3X)
π menu(3X) β Library calls π
okay bestie, sit down, hydrate, and let me tell you about menu β the literal blueprint for presenting menus in curses windows. no cap, this one's a whole library.
β¨ NAME β¨
menu β present menus in curses windows π
πΈ SYNOPSIS πΈ
#include <menu.h>
π¦ DESCRIPTION π¦
so the menu library is giving terminal-independent facilities for composing menu systems on character-cell terminals. icon behavior, truly. it comes in two flavors of routine:
- item routines β they create and modify menu items β¨
- menu routines β they group items into menus, display menus on the screen, and handle interaction with the user π
the menu library rides on the curses libraries, so a curses initialization routine such as initscr must be called before you use any of these functions. mandatory. non-negotiable. and when you link? you link with the options -lmenu -lcurses. that's the vibe. π
π Current Default Values for Item Attributes
the menu library keeps a default value for item attributes, lowkey like a little settings drawer. you can get or set this default by calling the appropriate get_ or set_ routine with a NULL item pointer. and listen β changing this default with a set_ function affects future item creations, but does not change the rendering of items that already exist. past items are past items, bestie. π«Ά
π Routine Name Index
here's the roster, the main character list, mapping every menu routine to the manual page that describes it:
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 universal "nope" signal π
routines that return an integer return one of these error codes, and each one is telling you exactly what went wrong:
E_OKβ the routine succeeded. slay. we love to see it β¨E_BAD_ARGUMENTβ routine detected an incorrect or out-of-range argument. you handed it something cursed πE_BAD_STATEβ routine was called from an initialization or termination function. wrong place, wrong time.E_NO_MATCHβ character failed to match. no match found, bestie πE_NO_ROOMβ menu is too large for its window. it's giving "doesn't fit" πE_NOT_CONNECTEDβ no items are connected to the menu. it's empty, it's lonely π¦E_NOT_POSTEDβ the menu has not been posted.E_NOT_SELECTABLEβ the designated item cannot be selected. sorry, that one's off-limits.E_POSTEDβ the menu is already posted. we been knew.E_REQUEST_DENIEDβ the menu driver could not process the request. denied. πE_SYSTEM_ERRORβ system error occurred (seeerrno(3)).E_UNKNOWN_COMMANDβ the menu driver code saw an unknown request code. who is she? never heard of her.
π NOTES π
fun fact: the header file menu.h itself includes the header file curses.h. free include, no extra work. you're welcome π
π PORTABILITY π
these routines emulate the System V menu library. they were not supported on Version 7 or BSD versions. so if you're time-traveling, adjust expectations accordingly πΈ
a menu facility was documented in SVr4.2's Character User Interface Programming document.
it is not part of X/Open Curses. no cap.
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, honestly π«Ά
π« SEE ALSO π«
curses(3X) and related pages whose names begin βmenu_β for detailed descriptions of the entry points. iykyk π
and that's the whole page, bestie β this was menu(3X) from ncurses 6.6, dated 2025-11-11. go forth and build the cutest little terminal menus ever. periodt π
β¨
π¦ where this page comes from
- alpine 3.24: ncurses-doc 6.6_p20260516-r0 Β· X11
- arch rolling: ncurses 6.6-2 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- Copyright 2018-2024,2025 Thomas E. Dickey
- Copyright 1998-2014,2017 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms