1menu(3X) menu(3X)
2
3
4
6 menu - curses extension for programming menus
7
9 #include <menu.h>
10
12 The menu library provides terminal-independent facilities for composing
13 menu systems on character-cell terminals. The library includes: item
14 routines, which create and modify menu items; and menu routines, which
15 group items into menus, display menus on the screen, and handle inter‐
16 action with the user.
17
18 The menu library uses the curses libraries, and a curses initialization
19 routine such as initscr must be called before using any of these func‐
20 tions. To use the menu library, link with the options -lmenu -lcurses.
21
22 Current Default Values for Item Attributes
23 The menu library maintains a default value for item attributes. You
24 can get or set this default by calling the appropriate get_ or set_
25 routine with a NULL item pointer. Changing this default with a set_
26 function affects future item creations, but does not change the render‐
27 ing of items already created.
28
29 Routine Name Index
30 The following table lists each menu routine and the name of the manual
31 page on which it is described.
32
33 curses Routine Name Manual Page Name
34 ────────────────────────────────────────────
35 current_item mitem_current(3X)
36 free_item mitem_new(3X)
37 free_menu menu_new(3X)
38 item_count menu_items(3X)
39 item_description mitem_name(3X)
40 item_index mitem_current(3X)
41 item_init menu_hook(3X)
42 item_name mitem_name(3X)
43 item_opts mitem_opts(3X)
44 item_opts_off mitem_opts(3X)
45 item_opts_on mitem_opts(3X)
46 item_term menu_hook(3X)
47 item_userptr mitem_userptr(3X)
48 item_value mitem_value(3X)
49 item_visible mitem_visible(3X)
50 menu_back menu_attributes(3X)
51 menu_driver menu_driver(3X)
52 menu_fore menu_attributes(3X)
53 menu_format menu_format(3X)
54 menu_grey menu_attributes(3X)
55 menu_init menu_hook(3X)
56 menu_items menu_items(3X)
57 menu_mark menu_mark(3X)
58 menu_opts menu_opts(3X)
59 menu_opts_off menu_opts(3X)
60 menu_opts_on menu_opts(3X)
61 menu_pad menu_attributes(3X)
62 menu_pattern menu_pattern(3X)
63 menu_request_by_name menu_requestname(3X)
64 menu_request_name menu_requestname(3X)
65 menu_spacing menu_spacing(3X)
66
67 menu_sub menu_win(3X)
68 menu_term menu_hook(3X)
69 menu_userptr menu_userptr(3X)
70 menu_win menu_win(3X)
71 new_item mitem_new(3X)
72 new_menu menu_new(3X)
73 pos_menu_cursor menu_cursor(3X)
74 post_menu menu_post(3X)
75 scale_menu menu_win(3X)
76 set_current_item mitem_current(3X)
77 set_item_init menu_hook(3X)
78 set_item_opts mitem_opts(3X)
79 set_item_term menu_hook(3X)
80 set_item_userptr mitem_userptr(3X)
81 set_item_value mitem_value(3X)
82 set_menu_back menu_attributes(3X)
83 set_menu_fore menu_attributes(3X)
84 set_menu_format menu_format(3X)
85 set_menu_grey menu_attributes(3X)
86 set_menu_init menu_hook(3X)
87 set_menu_items menu_items(3X)
88 set_menu_mark menu_mark(3X)
89 set_menu_opts mitem_opts(3X)
90 set_menu_pad menu_attributes(3X)
91 set_menu_pattern menu_pattern(3X)
92 set_menu_spacing menu_spacing(3X)
93 set_menu_sub menu_win(3X)
94 set_menu_term menu_hook(3X)
95 set_menu_userptr menu_userptr(3X)
96 set_menu_win menu_win(3X)
97 set_top_row mitem_current(3X)
98 top_row mitem_current(3X)
99 unpost_menu menu_post(3X)
100
102 Routines that return pointers return NULL on error. Routines that re‐
103 turn an integer return one of the following error codes:
104
105 E_OK The routine succeeded.
106
107 E_BAD_ARGUMENT
108 Routine detected an incorrect or out-of-range argument.
109
110 E_BAD_STATE
111 Routine was called from an initialization or termination function.
112
113 E_NO_MATCH
114 Character failed to match.
115
116 E_NO_ROOM
117 Menu is too large for its window.
118
119 E_NOT_CONNECTED
120 No items are connected to the menu.
121
122 E_NOT_POSTED
123 The menu has not been posted.
124
125 E_NOT_SELECTABLE
126 The designated item cannot be selected.
127
128 E_POSTED
129 The menu is already posted.
130
131 E_REQUEST_DENIED
132 The menu driver could not process the request.
133
134 E_SYSTEM_ERROR
135 System error occurred (see errno(3)).
136
137 E_UNKNOWN_COMMAND
138 The menu driver code saw an unknown request code.
139
141 The header file <menu.h> automatically includes the header files
142 <curses.h> and <eti.h>.
143
144 In your library list, libmenu.a should be before libncurses.a; that is,
145 you should say “-lmenu -lncurses”, not the other way around (which
146 would give a link-error when using static libraries).
147
149 These routines emulate the System V menu library. They were not sup‐
150 ported on Version 7 or BSD versions.
151
152 The menu facility was documented in SVr4.2 in Character User Interface
153 Programming (UNIX SVR4.2).
154
155 It is not part of X/Open Curses.
156
157 Aside from ncurses, there are few implementations:
158
159 • systems based on SVr4 source code, e.g., Solaris.
160
161 • NetBSD curses.
162
164 Juergen Pfeifer. Manual pages and adaptation for ncurses by Eric S.
165 Raymond.
166
168 curses(3X) and related pages whose names begin “menu_” for detailed de‐
169 scriptions of the entry points.
170
171 This describes ncurses version 6.4 (patch 20230114).
172
173
174
175 menu(3X)