menu_items(3X)

okay bestie, so this is menu_items(3X) from the ncurses library-calls corner of the universe, and it's literally about making and breaking the connections between items and menus. like, matching them up. situationship management, but for cursors. πŸ’…


✨ NAME ✨

set_menu_items, menu_items, item_count β€” make and break connections between items and menus 🫢


🌸 SYNOPSIS 🌸

#include <menu.h>

int set_menu_items(MENU *menu, ITEM **items);
ITEM **menu_items(const MENU *menu);
int item_count(const MENU *menu);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so first up, set_menu_items β€” she changes the item pointer array of the given menu. and like, the array must be terminated by a NULL. no cap, that's a hard requirement. that NULL is the periodt at the end of the sentence. πŸ™ˆ

then we have menu_items, the lowkey simpler one β€” she just returns the item array of the given menu. that's it. that's the whole job. πŸ‘‘

and finally item_count, who returns the count of items in menu. the headcount. the roster. the attendance sheet. 🌈


πŸ’œ RETURN VALUE πŸ’œ

  • menu_items returns a pointer β€” which may be NULL. and ngl, it does not set errno. so don't go checking that, bestie, it's not the vibe. πŸŽ€
  • item_count returns ERR (that's the general curses error return value, the classic πŸ’€) if its menu parameter is NULL. like, if you hand her nothing, she's gonna give you ERR back.
  • set_menu_items returns one of the following codes on error:
    • E_OK β€” the routine succeeded. slay, we ate. ✨
    • E_BAD_ARGUMENT β€” routine detected an incorrect or out-of-range argument. you gave her something she simply could not work with, bestie. 😭
    • E_NOT_CONNECTED β€” no items are connected to the menu. empty. barren. nothing attached. the group chat has zero members. 🫢
    • E_POSTED β€” the menu is already posted. she's busy, she's out, she's on main character energy and cannot be edited rn. πŸ’…
    • E_SYSTEM_ERROR β€” system error occurred (see errno(3)). something went wrong at the system level, go read errno(3) for the tea. πŸ“

🧚 PORTABILITY 🧚

these routines emulate the System V menu library. they were not supported on Version 7 or BSD versions. so like, if you're on a V7 or BSD situation, this is not giving what you need. πŸ’€

also, the SVr4 menu library documentation specifies the item_count error value as -1 (which is the value of ERR). just so you know. iykyk. πŸ‘‘


πŸ‘‘ AUTHORS πŸ‘‘

Juergen Pfeifer. manual pages and adaptation for new curses by Eric S. Raymond. iconic behavior from both of them, fr fr. 🫢


🌟 SEE ALSO 🌟

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

ok literally the whole point: set_menu_items connects (remember the NULL terminator, bestie!!), menu_items reads, item_count counts. don't skip the NULL. the NULL is not optional. the NULL is the moment. 😀

and that's the page, bestie!! this one came from ncurses 6.6, dated 2024-12-28, and yes it's still serving menu_items(3X) energy. mwah πŸ’–

πŸ“¦ where this page comes from