form_new(3X)

πŸ’– new_form β€” bestie edition πŸ’–

okay so this is form_new(3X) from the Library calls section, and it's literally the page where you make forms and then un-make them. creation and destruction. main character arc fr fr ✨


🌸 NAME 🌸

new_form, free_form β€” create and destroy forms πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <form.h>

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

✨ DESCRIPTION ✨

okay so new_form is the one that creates a new form and connects it to a specified field pointer array. and bestie, listen β€” that array must be NULL-terminated. no cap. if you forget the NULL at the end, the vibe check fails and everything goes sideways πŸ’€

and then free_form is the cleanup queen πŸ‘‘ she disconnects form from its field array and frees the storage that was allocated for the form. so it's giving ✨closure✨


πŸ’… RETURN VALUE πŸ’…

so new_form returns NULL on error 😭 and it sets errno based on how the whole thing went:

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

and free_form returns one of these cuties:

  • E_OK β€” the routine succeeded. periodt πŸ’–
  • E_BAD_ARGUMENT β€” routine detected an incorrect or out-of-range argument 🫠
  • E_POSTED β€” the form has already been posted. so you can't just free it like that, it's busy being iconic πŸ”₯

🌈 PORTABILITY 🌈

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


πŸ“ AUTHORS πŸ“

Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. absolute legends, we love them πŸ’œ


πŸ‘‘ SEE ALSO πŸ‘‘

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

okay that's the whole page bestie, ily, go build some forms πŸ«ΆπŸ’–

ncurses 6.6 Β· 2024-12-28 β€” and that's the sign-off, dated and versioned like the icon it is. mwah πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from