new(3FORM)

✨ new(3FORM) ✨

okay bestie, welcome to new(3FORM) from the Library calls section of the manual β€” this is the one about making and unmaking forms, and honestly? it's giving main character energy for the whole forms library. πŸ’…


πŸŽ€ NAME πŸŽ€

new_form, free_form β€” create and destroy forms. that's it, that's the whole vibe. πŸ’–


🌸 SYNOPSIS 🌸

#include <form.h>

FORM *new_form(FIELD **fields);
int free_form(FORM *form);

like, include the header first, obviously. πŸ™ˆ


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, new_form creates a brand new form, and it connects that form to a specified field pointer array. important detail: that array must be NULL-terminated. no cap. if you forget the NULL at the end, that's on you, bestie. πŸ’€

and then free_form? she's the closer. she disconnects form from its field array and frees the storage that was allocated for the form. clean exit, no mess, periodt. ✨


πŸ’œ RETURN VALUE πŸ’œ

new_form returns NULL on error. and when it does that, it sets errno according to how the function went:

  • E_OK β€” the routine succeeded. slay. πŸŽ‰
  • E_BAD_ARGUMENT β€” the routine detected an incorrect or out-of-range argument. πŸ™ˆ
  • E_CONNECTED β€” the field is already connected to a form. she's taken, babes. πŸ’”
  • E_SYSTEM_ERROR β€” a system error occurred, e.g., malloc failure. 😭

meanwhile free_form returns one of these:

  • E_OK β€” the routine succeeded. 🫢
  • E_BAD_ARGUMENT β€” the routine detected an incorrect or out-of-range argument. πŸ“
  • E_POSTED β€” the form has already been posted. you can't just free a posted form, bestie, that's not the move. πŸ’…

🌈 PORTABILITY 🌈

these routines emulate the System V forms library. they were not supported on Version 7 or BSD versions. so if you're time-traveling to ancient Unix, this is not the moment, iykyk. 🧚


πŸ‘‘ AUTHORS πŸ‘‘

Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. legends, honestly. πŸ’–


⭐ 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 build ur forms, you absolute icon. πŸ¦‹πŸ’–βœ¨

πŸ“¦ where this page comes from