field_buffer(3FORM)
π field_buffer(3FORM) β the form_field_buffer glow-up π
okay bestie, so this is field_buffer from the Library calls section of the manual, and it's all about wrangling field buffers in ncurses forms. yes the header said field_buffer(3FORM) twice, we get it, it's iconic, moving on π
β¨ NAME β¨
form_field_buffer β field buffer control, aka the remote control for your field's lil text storage π
πΈ SYNOPSIS πΈ
#include <form.h>
int set_field_buffer(FIELD *field, int buf, const char *value);
char *field_buffer(const FIELD *field, int buffer);
int set_field_status(FIELD *field, bool status);
bool field_status(const FIELD *field);
int set_max_field(FIELD *field, int max);
π¦ DESCRIPTION π¦
so the function set_field_buffer sets the numbered buffer of the given field to contain a given string, and the deets are:
- Buffer
0is the displayed value of the field. that's the main character one, no cap π - Other numbered buffers may be allocated by applications through the
nbufargument of (seefield_new(3FORM)) but are not manipulated by the forms library. so like, the library is not touching those, they're yours, handle with care fr fr.
then the function field_buffer returns a pointer to the contents of the given numbered buffer, and listen up because this part is important:
- The buffer contents always have the same length, and are padded with trailing spaces as needed to ensure this length is the same. consistency slay π
- The buffer may contain leading spaces, depending on how it was set. it's giving "depends on the vibe of how you set it" β¨
- The buffer contents are set with
set_field_buffer, or as a side effect of any editing operations on the corresponding field. - Editing operations are based on the window which displays the field, rather than a string. The window contains only printable characters, and is filled with blanks. If you want the raw data, you must write your own routine that copies the value out of the buffer and removes the leading and trailing spaces. yes bestie, you have to do the trimming, the library said not my job π
- Because editing operations change the content of the buffer to correspond to the window, you should not rely on using buffers for long-term storage of form data. it's giving temporary situationship, do NOT save your form data in there for later π
The function set_field_status sets the associated status flag of field; field_status gets the current value. The status flag is set to a nonzero value whenever the field changes. she's tracking everything, periodt.
The function set_max_field sets the maximum size for a dynamic field. An argument of 0 turns off any maximum size threshold for that field. zero means no limits, main character energy π
π RETURN VALUE π
The field_buffer function returns NULL on error. It sets errno according to their success:
E_OKβ The routine succeeded. ate and left no crumbs πE_BAD_ARGUMENTβ Routine detected an incorrect or out-of-range argument. bestie what did you pass in π
The field_status function returns TRUE or FALSE.
The remaining routines return one of the following:
E_OKβ The routine succeeded. we love to see it β¨E_SYSTEM_ERRORβ System error occurred (seeerrno(3)). the system is going through it πE_BAD_ARGUMENTβ Routine detected an incorrect or out-of-range argument. not again π
π NOTES π
When configured for wide characters, field_buffer returns a pointer to temporary storage (allocated and freed by the library). The application should not attempt to modify the data. It will be freed on the next call to field_buffer to return the same buffer. so like, look but don't touch, and also don't get attached, it's leaving on the next call π«Ά
π PORTABILITY π
These routines emulate the System V forms library. They were not supported on Version 7 or BSD versions. old school vibes only, iykyk.
The set_max_field function checks for an ncurses extension O_INPUT_FIELD which allows a dynamic field to shrink if the new limit is smaller than the current field size. shrinkage rights β
π AUTHORS π
Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. absolute legends, we stan π
β SEE ALSO β
ncurses(3NCURSES) and related pages whose names begin βform_β for detailed descriptions of the entry points. go read those too bestie, there's a whole universe of form_ pages out there π¦
and that's the tea, bestie! this was ncurses 6.6, dated 2024-12-28, straight from the field_buffer(3FORM) page β you're officially a field buffer expert now, go forth and slay π
β¨π
π¦ 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,2017 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms