field_userptr(3FORM)

πŸ’– field_userptr β€” bestie, let's attach ur lil data to a form field πŸ’–

okay so this is a libcurses / ncurses library call page, and it's honestly so underrated. we're talking set_field_userptr and field_userptr β€” the duo that lets u stash application-specific data on a form field. no cap, every field gets one of these lil pockets and the form driver literally never touches it. it's urs. 🫢


✨ NAME ✨

set_field_userptr, field_userptr β€” associate application data with a form field πŸŽ€


🌸 SYNOPSIS 🌸

#include <form.h>

int set_field_userptr(FIELD *field, void *userptr);
void *field_userptr(const FIELD *field);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea πŸ“: every single form field has a field β€” yes i said it like that β€” that u can use to hold application-specific data. and when i say application-specific, i mean the form-driver code leaves it alone. it does not touch it. it does not look at it. it minds its own business. periodt.

these two functions are the getter and the setter for that field. one puts ur stuff in, one gets ur stuff out. iconic behaviour, truly. πŸ‘‘


πŸ’… RETURN VALUE πŸ’…

  • field_userptr hands u back a pointer β€” and yes bestie, it may be NULL, that's allowed, don't panic. also important: it does not set errno. not even a little bit.
  • set_field_userptr returns E_OK, which is the success vibe. that's it. that's the whole return value. slay. ✨

🌈 PORTABILITY 🌈

  • these routines emulate the System V forms library. they were not supported on Version 7 or BSD versions. so if ur on one of those, sorry bestie, no user pointer for u 😭
  • the user pointer is a void pointer. and the reason is kinda juicy: we chose not to leave it as a char pointer, for SVr4 compatibility. iykyk. πŸ’€

πŸ‘‘ AUTHORS πŸ‘‘

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

πŸŽ€ SEE ALSO πŸŽ€

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

and that's the whole page, bestie!! this was ncurses 6.6, dated 2024-12-28 β€” go forth and stash ur pointers, u absolute main character πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from