form_field_new(3X)
π form_field_new(3X) β or, how to birth and yeet a form field
okay so bestie, this is a page from the ncurses manual set (it's the 3X library section, iykyk) and it's literally all about making fields and unmaking fields. Four little functions, one big vibe. Let's get into it π
β¨ NAME β¨
new_field, dup_field, link_field, free_field β create and destroy form fields. That's it, that's the whole gig: you make 'em, you copy 'em, you link 'em, you free 'em. π
πΈ SYNOPSIS πΈ
#include <form.h>
FIELD *new_field(int height, int width,
int toprow, int leftcol,
int offscreen, int nbuffers);
FIELD *dup_field(FIELD *field, int toprow, int leftcol);
FIELD *link_field(FIELD *field, int toprow, int leftcol);
int free_field(FIELD *field);
like, copy that #include <form.h> exactly or nothing works, no cap π
π¦ DESCRIPTION π¦
π new_field
new_field allocates a brand-new field and initializes it from the parameters you hand it: height, width, row of upper-left corner, column of upper-left corner, number off-screen rows, and number of additional working buffers. Six numbers, one fresh field. It's giving main character energy β¨
π dup_field
dup_field duplicates a field at a new location. Most attributes are copied β and bestie when I say most, I mean the list is long:
- current contents
- size
- validation type
- buffer count
- growth threshold
- justification
- foreground
- background
- pad character
- options
- user pointer
But not everything, okay? Field status and the field page bit are not copied. Those two stay home. π
π link_field
link_field acts like dup_field, but the new field shares buffers with its parent β attribute data is separate though. So they're linked at the buffer level but their vibes/attrs are their own. It's giving siblings who share a closet but not a personality π«Ά
β free_field
free_field de-allocates storage associated with a field. Cleanup era. Say bye π
π₯ RETURN VALUE π₯
new_field, dup_field, and link_field return NULL on error. They set errno according to their success (yes, that phrasing is a little unhinged, but it's what the page says, and we respect the lore):
E_OKβ the routine succeeded.E_BAD_ARGUMENTβ routine detected an incorrect or out-of-range argument.E_SYSTEM_ERRORβ system error occurred, e.g.,mallocfailure.
The function free_field returns one of the following:
E_OKβ the routine succeeded.E_BAD_ARGUMENTβ routine detected an incorrect or out-of-range argument.E_CONNECTEDβfieldis connected.
β οΈ heads up: E_CONNECTED means the field is still connected to something, so it's not getting freed. Don't fight it, just disconnect first bestie π
π§ PORTABILITY π§
These routines emulate the System V forms library. They were not supported on Version 7 or BSD versions β so if you're on ancient territory, this is not your era, sorry π
it may be unwise to count on the set of attributes copied by dup_field being portable; the System V forms library documents are not very explicit about what gets copied and what does not.
so likeβ¦ fr fr, don't build your whole personality on that assumption. lowkey risky. π
π AUTHORS π
Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. legends, honestly π«Ά
π SEE ALSO π
curses(3X)form(3X)
and that's the page, bestie β brought to you by ncurses 6.5, dated 2024-12-28. go forth and create fields responsibly πΈπ β¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright 2018-2023,2024 Thomas E. Dickey
- Copyright 1998-2010,2015 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms