mitem_userptr(3X)
π mitem_userptr(3X) π
okay bestie, so this one's a library call from the ncurses girlies β it's called mitem_userptr(3X) and it's literally the "here's my stuff, hold it for me" page for menu items. no cap.
β¨ NAME β¨
set_item_userptr, item_userptr β associate application data with a menu item π
πΈ SYNOPSIS πΈ
#include <menu.h>
int set_item_userptr(ITEM *item, void *userptr);
void *item_userptr(const ITEM *item);
π¦ DESCRIPTION π¦
so every single menu item has a field, right? and that field exists purely so you can stash your own application-specific data in it. and the way the menu-driver code handles it? it leaves it alone. completely. it does not touch it, it does not look at it, it minds its own business. periodt. π
these two functions are your get-and-set duo for that field. that's it, that's the whole vibe.
π RETURN VALUE π
item_userptrhands you back a pointer. and yes, that pointer can beNULLβ no drama, that's allowed. also: it does not seterrno.set_item_userptralways returnsE_OK, which means success. every time. iconic behaviour honestly. β¨
π 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 on ancient BSD, sorry bestie, no userptr for you. π
and the user pointer is a void pointer. we deliberately did not leave it as a char pointer, because of SVr4 compatibility. that's the reason, that's the lore, iykyk.
π AUTHORS π
Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. absolute legends, we love them, no notes. π«Ά
π SEE ALSO π
curses(3X)menu(3X)
ngl the void * thing is doing main character energy β it just wants to be compatible with SVr4, let it live. π
and that's a wrap, babe! this page came to you courtesy of ncurses 6.6, dated 2024-12-28. go forth and stash your pointers. ππΈβ¨
π¦ where this page comes from
- alpine 3.24: ncurses-doc 6.6_p20260516-r0 Β· X11
- arch rolling: ncurses 6.6-2 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- 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