form_userptr(3X)

πŸ’– form_userptr β€” bestie, let's attach YOUR data to a form πŸ’–

okay so this is a page from the ncurses manual, and it lives in the Library calls section β€” the manual name is form_userptr(3X) if you're keeping score ✨


🌸 NAME 🌸

set_form_userptr, form_userptr β€” associate application data with a form item 🫢


✨ SYNOPSIS ✨

#include <form.h>

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

no cap, that's the whole vibe πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea, bestie: every form and every form item has a little field that's yours to fill with whatever application-specific data you want. Like, the form-driver code literally leaves it alone β€” it does not touch it, it does not look at it, it's your lil storage cubby πŸŽ€

These two functions are the getter and the setter for that form user pointer field. That's it. That's the whole job. Iconic, honestly πŸ‘‘


πŸ”₯ RETURN VALUE πŸ”₯

  • The function form_userptr returns a pointer β€” and heads up, that pointer may be NULL πŸ™ˆ It does not set errno.
  • The function set_form_userptr returns E_OK (which means success, slay ✨).

🌈 PORTABILITY 🌈

  • These routines emulate the System V forms library. They were not supported on Version 7 or BSD versions β€” so if you're kicking it old-school on those, sorry bestie, no user pointer for you 😭
  • The user pointer is a void pointer. And here's why: we chose not to leave it as a char pointer for SVr4 compatibility. So that's a deliberate choice, not a mistake, periodt πŸ’―

πŸ‘‘ AUTHORS πŸ‘‘

Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. legends, fr fr 🫑


πŸ’œ SEE ALSO πŸ’œ

  • curses(3X)
  • form(3X)

and that's the whole page, bestie!! this one is from ncurses 6.6, dated 2024-12-28 β€” go forth and store your little pointers, you absolute main character πŸ§šπŸ’–

πŸ“¦ where this page comes from