menu_userptr(3X)

okay bestie, so this is a page from the library calls girlies β€” it's menu_userptr, living its best life in the curses neighborhood ✨


🌸 NAME 🌸

set_menu_userptr, menu_userptr β€” the way you attach your own lil application data to a menu item πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <menu.h>

int set_menu_userptr(MENU *menu, void *userptr);
void *menu_userptr(const MENU *menu);

✨ DESCRIPTION ✨

So like. Every menu and every menu item has a field, right? And that field is just there for you to stash whatever application-specific data your heart desires πŸ’… the menu-driver code literally leaves it alone, it does not touch it, it does not look at it, it minds its own business, iconic behavior fr fr.

These two functions are the getter and the setter for that menu user pointer field. That's it. That's the whole job 🫢


πŸ’€ RETURN VALUE πŸ’€

  • menu_userptr hands you back a pointer (and yes, it can be NULL, no shame in that). It does not set errno β€” it's just vibing, not reporting errors.
  • set_menu_userptr returns E_OK, which is success. Slay. πŸ‘‘

🌈 PORTABILITY 🌈

These routines emulate the System V menu library. Not supported on Version 7 or BSD versions β€” so if you're on those, sorry bestie, this isn't for you 😭

Also important: the user pointer is a void pointer. And why? Because they chose not to leave it as a char pointer, for SVr4 compatibility. That's the whole reason. Periodt.


πŸ‘‘ AUTHORS πŸ‘‘

Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond.


🌟 SEE ALSO 🌟

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

and that's the whole page, no notes 🧚 this was ncurses 6.6, dated 2024-12-28 β€” go forth and store your pointers, you absolute main character πŸ’œ

πŸ“¦ where this page comes from