menu(3X)
π menu(3X) β library calls, but make it make sense β¨
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 (seeerrno(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
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright 2018-2024,2025 Thomas E. Dickey
- Copyright 1998-2014,2017 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms