field_new(3FORM)
π field_new β bestie, we're making FIELDS π
okay so this is field_new(3FORM), a library call from the forms corner of ncurses, and it's literally the whole "make a field, clone a field, yeet a field" starter pack. no cap.
β¨ NAME β¨
new_field, dup_field, link_field, free_field β the four functions that create and destroy form fields. birth, photocopy, shared-custody copy, and goodbye π
πΈ 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);
π¦ DESCRIPTION π¦
new_field β the birth scene π
new_field allocates a brand-new field and initializes it straight from the parameters you handed over: height, width, the toprow of the upper-left corner, the leftcol of the upper-left corner, the number of off-screen rows, and the number of additional working buffers. it's giving "custom order, made fresh" β¨
dup_field β the clone π
dup_field duplicates a field at a new location. and bestie, it copies a LOT β most attributes, including:
- current contents
- size
- validation type
- buffer count
- growth threshold
- justification
- foreground
- background
- pad character
- options
- user pointer
what it does NOT copy: the field status and the field page bit. those stay behind, sorry babe π
link_field β the clone that shares π«Ά
link_field acts like dup_field, BUT the new field shares buffers with its parent. the attribute data stays separate though. so like, same brain cell, different personality. iconic.
free_field β the goodbye π
free_field de-allocates the storage associated with a field. releasing her into the wild. ποΈ
β RETURN VALUE β
new_field, dup_field and link_field return NULL on error π and they set errno according to their success:
E_OKβ the routine succeeded. slay.E_BAD_ARGUMENTβ routine detected an incorrect or out-of-range argument. bestie what did you type.E_SYSTEM_ERRORβ system error occurred, e.g.,mallocfailure. the machine said no.
free_field returns one of these:
E_OKβ the routine succeeded. πE_BAD_ARGUMENTβ routine detected an incorrect or out-of-range argument. πE_CONNECTEDβfieldis connected. she's taken, you can't just free her like that. π«
π PORTABILITY π
these routines emulate the System V forms library. they were not supported on Version 7 or BSD versions. so like, vintage-only energy, iykyk.
and lowkey β 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 don't be shocked if another system does it differently, fr fr. π
π AUTHORS π
Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. absolute legends, no notes. π«Ά
π SEE ALSO π
ncurses(3NCURSES)form(3FORM)
and that's the whole page bestie!! this was field_new(3FORM) from ncurses 6.6, dated 2024-12-28 β go forth and build fields, you're the main character now π
β¨πΈ
π¦ where this page comes from
- ubuntu resolute: ncurses-doc 6.6+20251231-1 Β· MIT/X11
- ubuntu stonking: ncurses-doc 6.6+20260608-2 Β· MIT/X11
- Copyright 2018-2023,2024 Thomas E. Dickey
- Copyright 1998-2010,2015 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms