menu_userptr(3MENU)
β¨ menu_userptr β bestie edition β¨
okay so this is menu_userptr(3MENU) from the library calls corner of the ncurses world, and it's genuinely such a cute lil pair of functions, like the emotional support pocket of the menu library π
πΈ NAME πΈ
set_item_userptr, item_userptr β associate application data with a menu item π
like. you get to tuck your own lil thing inside a menu item and it just⦠lives there. no cap.
π¦ SYNOPSIS π¦
#include <menu.h>
int set_item_userptr(ITEM *item, void *userptr);
void *item_userptr(const ITEM *item);
π DESCRIPTION π
so here's the vibe: every single menu item has a field that exists purely for application-specific data β and like, the menu-driver code just leaves it alone. doesn't touch it. doesn't look at it. it's yours. main character energy fr fr π
these two functions are the getter and the setter for that field. one of them sets it, one of them gets it. iconic behaviour, honestly.
β RETURN VALUE β
item_userptrreturns a pointer β and yeah, that pointer can beNULL, that's allowed, it's fine, deep breaths π«Ά. it does not seterrno.set_item_userptralways returnsE_OK, which is the success value. always. every time. no drama, no surprises, slay π
π PORTABILITY π
- these routines emulate the System V menu library. they were not supported on Version 7 or BSD versions, so like, if you're time-travelling back there, sorry bestie π
- the user pointer is a
voidpointer. they chose not to leave it as acharpointer, and the reason is SVr4 compatibility. periodt.
π AUTHORS π
Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. absolute legends, we stan π§
π₯ SEE ALSO π₯
ncurses(3NCURSES)menu(3MENU)
ncurses 6.6 Β· 2024-12-28 β and that's the whole page bestie, go forth and stash ur data in ur menu items, ily ππΈ
π¦ where this page comes from
- ubuntu resolute: ncurses-doc 6.6+20251231-1 Β· MIT/X11
- ubuntu stonking: ncurses-doc 6.6+20260608-2 Β· MIT/X11
- Copyright 2018-2023,2024 Thomas E. Dickey
- Copyright 1998-2010,2015 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms