items(3MENU)

πŸ’– items(3MENU) β€” library calls, but make it a vibe ✨

okay bestie, so we're in items(3MENU) territory, which is the part of the library where you make and break connections between items and menus πŸŽ€ it's giving matchmaker energy fr fr, and honestly? we're obsessed.


🌸 NAME 🌸

set_menu_items, menu_items, item_count β€” these three are literally the glue that makes and breaks connections between items and menus. periodt. πŸ’…


✨ SYNOPSIS ✨

#include <menu.h>

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

yes, that's it, that's the whole lil squad 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

So like, three functions, three jobs, all iconic in their own way:

  • set_menu_items β€” this one changes the item pointer array of the given menu. and listen, the array must be terminated by a NULL. no cap. if you forget the NULL bestie, that's a whole situation you do not want πŸ’€
  • menu_items β€” this one just hands you back the item array of the given menu. lowkey the chill one of the group 🌈
  • item_count β€” and this one returns the count of items in menu. the math girlie of the trio, we stan πŸ“

πŸ”₯ RETURN VALUE πŸ”₯

  • menu_items returns a pointer β€” which may be NULL, so pls check it πŸ™ˆ β€” and it does not set errno.
  • item_count returns ERR (aka the general curses error return value) if its menu parameter is NULL. so yeah, pass a real menu, not vibes ✨
  • set_menu_items returns one of the following codes when something goes sideways:
  • E_OK β€” the routine succeeded. slay, we love to see it πŸ‘‘
  • E_BAD_ARGUMENT β€” routine detected an incorrect or out-of-range argument. not the argument being messy 😭
  • E_NOT_CONNECTED β€” no items are connected to the menu. it's giving ghosted πŸ’€
  • E_POSTED β€” the menu is already posted. can't do the thing while it's out there living its main character moment, sorry πŸŽ€
  • E_SYSTEM_ERROR β€” system error occurred (see errno(3)). the computer said no 🌧️

πŸ’œ PORTABILITY πŸ’œ

These routines emulate the System V menu library. they were not supported on Version 7 or BSD versions, so if you're kicking it old-school with those, bestie, you're on your own 🧚

Also important, highkey: the SVr4 menu library documentation specifies the item_count error value as -1 (which is the value of ERR). so like, same energy, different spelling πŸ’…


🌟 AUTHORS 🌟

Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. absolute legends, ty for your service 🫢


🌈 SEE ALSO 🌈

  • ncurses(3NCURSES)
  • menu(3MENU)

go read those next bestie, it's a whole journey ✨


okay and that's the whole page!! πŸ’– this was ncurses 6.6, dated 2024-12-28, and it's the items(3MENU) girlies signing off β€” stay connected, terminate your arrays with NULL, and don't be a E_POSTED situation πŸŽ€πŸ’…βœ¨

πŸ“¦ where this page comes from