field_info(3FORM)
β¨ field_info β it's giving "tell me everything about my field" π
okay bestie, so this is a page from the ncurses Library calls girlies (yes, section 3FORM, we're fancy like that) and it's literally just two little functions whose whole job is spilling the tea about a FIELD π«β¨
π NAME π
dynamic_field_info, field_info β retrieve field characteristics
like⦠they get the deets on your field. that's the whole gig. periodt.
π¦ SYNOPSIS π¦
#include <form.h>
int field_info(const FIELD *field,
int *rows, int *cols,
int *frow, int *fcol,
int *nrow, int *nbuf);
int dynamic_field_info(const FIELD *field,
int *rows, int *cols, int *max);
no cap, that's the whole vibe. two functions, one header, and a lot of int * pointers bestie π
π DESCRIPTION π
so, field_info returns the sizes and other attributes that were passed in to the field at its creation time. it's giving "receipts from the day you were born" π
the attributes are: height, width, row of upper-left corner, column of upper-left corner, number off-screen rows, and number of working buffers.
meanwhile dynamic_field_info is the main character who tells you the actual size of the field and its maximum possible size. very "current situation + your full potential" energy π
and here's the lil plot twist: if the field has no size limit, the location addressed by the third argument gets set to 0. so like, unlimited. no ceiling. free. β¨
a field can be made dynamic by turning off the O_STATIC option with field_opts_off. that's the whole ritual, bestie π―οΈ
π RETURN VALUE π
these routines return one of the following, and you will be checking, because ignoring return values is not the vibe:
E_OKβ the routine succeeded. ate. no notes. πE_SYSTEM_ERRORβ a system error occurred (seeerrno(3)). something went wrong in the machine and it's not your fault, go touch grass πΈE_BAD_ARGUMENTβ the routine detected an incorrect or out-of-range argument. bestie. bestie. what did you pass in. π
π§ 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, that's a you problem, not a them problem π
also, a null (zero pointer) is accepted for any of the return values, to ignore that value. so you can be like "i only care about rows, the rest is background noise" and it will simply not write to the ones you nulled. iconic behaviour tbh.
but β and this is the important part β not all implementations allow this, e.g., Solaris 2.7 does not. so like, check before you get cute with nulls on other platforms, iykyk π¨
π AUTHORS π
Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond.
(we stan them. legends. thank you for your service π«Ά)
β SEE ALSO β
ncurses(3NCURSES) and related pages whose names begin βform_β for detailed descriptions of the entry points.
like if this page wasn't enough for you (fair), go read the form_ girlies, they have the full lore π
okay that's the page!! and a lil sign-off: this is from ncurses 6.6, dated 2024-03-16, filed under field_info(3FORM). stay safe, read your return values, and don't forget to null out the args you don't need πβ¨π¦
π¦ 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