userptr(3FORM)

✨ userptr β€” bestie edition ✨

okay so this is the userptr(3FORM) page, from the 3FORM library-calls girlies πŸ’… it's short, it's sweet, it's literally just two little functions that hold your stuff for you. let's go πŸŽ€


🌸 NAME 🌸

set_form_userptr, form_userptr β€” the way you attach your own app data to a form item 🫢


✨ SYNOPSIS ✨

#include <form.h>

int set_form_userptr(FORM *form, void *userptr);
void* form_userptr(const FORM *form);

πŸ’– DESCRIPTION πŸ’–

okay so picture this: every single form and every single form item has a little field just sitting there, and that field is for you. like, it's your little shelf for application-specific data. and the form-driver code? it leaves it alone. doesn't touch it, doesn't look at it, doesn't text it back. it's giving respectful. πŸ™ˆ

these two functions are literally just the getter and the setter for the form user pointer field. that's it. that's the whole job. get, set, slay. ✨


πŸ”₯ RETURN VALUE πŸ”₯

  • form_userptr β€” hands you back a pointer. and yes bestie, it may be NULL, that's allowed. also it does not set errno, so don't go checking that for gossip, it's not talking.
  • set_form_userptr β€” returns E_OK. that's it. success. periodt. πŸ’…

🌈 PORTABILITY 🌈

so these routines emulate the System V forms library. they were not supported on Version 7 or BSD versions β€” so if you're time-traveling back there, sorry bestie, no user pointer for you 😭

and here's a lil lore drop: the user pointer is a void pointer. they chose not to leave it as a char pointer for SVr4 compatibility. iconic decision-making honestly πŸ‘‘


πŸ‘‘ AUTHORS πŸ‘‘

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


πŸ¦‹ SEE ALSO πŸ¦‹

  • ncurses(3NCURSES)
  • form(3FORM)

ngl this is one of the chillest pages in the whole set β€” no scary warnings, no undefined behaviour, just a lil pointer holding your stuff πŸ“

and that's the vibe check bestie πŸ’œ this was ncurses 6.6, dated 2024-12-28 β€” go off, userptr(3FORM) 🌟

πŸ“¦ where this page comes from