form(3FORM)
β¨ form(3FORM) β¨
okay bestie, sit down, hydrate, because today we're talking about form β the Library calls girlie who presents user-fillable forms in curses windows. yes, forms. like, actual input fields. in a terminal. it's giving 1993 but make it slay π
πΈ NAME πΈ
form β present user-fillable forms in curses windows π
π¦ SYNOPSIS π¦
#include <form.h>
that's it. that's the whole synopsis. iconic of her tbh β¨
π DESCRIPTION π
The form library provides terminal-independent facilities for composing form screens on character-cell terminals. no cap, it does not care what terminal you're on, she will show up and she will render.
The library includes two whole friend groups:
- field routines, which create and modify form fields βοΈ
- form routines, which group fields into forms, display forms on the screen, and handle interaction with the user π
The form library uses the curses libraries. To use the form library, link with the options -lform -lcurses. do not forget these, bestie, or you will get the saddest little linker errors of your life π
Your program should set up the locale, e.g.,
setlocale(LC_ALL, "");
so that input/output processing will work. fr fr, set your locale.
A curses initialization routine such as initscr must be called before using any of these functions. like, initscr first, then the form stuff. that's the order. periodt.
π Current Default Values for Field Attributes π
The form library maintains a default value for field attributes. You can get or set this default by calling the appropriate set_ or retrieval routine with a **NULL field pointer. yes, NULL` is the secret handshake.
changing this default with a set_ function affects future field creations, but does not change the rendering of fields already created. the old fields said "I'm not changing for anybody" π
π Routine Name Index π
here's the whole roster, bestie. every form routine and the manual page where it's described. routines flagged with a β*β are ncurses-specific, not present in SVr4 β so if you're on some other implementation, don't come crying to me about those ones π
current_fieldβpage(3FORM)data_aheadβdata(3FORM)data_behindβdata(3FORM)dup_fieldβfield_new(3FORM)dynamic_field_infoβfield_info(3FORM)field_argβfield_validation(3FORM)field_backβfield_attributes(3FORM)field_bufferβfield_buffer(3FORM)field_countβfield(3FORM)field_foreβfield_attributes(3FORM)field_indexβpage(3FORM)field_infoβfield_info(3FORM)field_initβhook(3FORM)field_justβfield_just(3FORM)field_optsβfield_opts(3FORM)field_opts_offβfield_opts(3FORM)field_opts_onβfield_opts(3FORM)field_padβfield_attributes(3FORM)field_statusβfield_buffer(3FORM)field_termβhook(3FORM)field_typeβfield_validation(3FORM)field_userptrβfield_userptr(3FORM)form_driverβdriver(3FORM)form_driver_wβdriver(3FORM)*form_fieldsβfield(3FORM)form_initβhook(3FORM)form_optsβopts(3FORM)form_opts_offβopts(3FORM)form_opts_onβopts(3FORM)form_pageβpage(3FORM)form_request_by_nameβrequestname(3FORM)*form_request_nameβrequestname(3FORM)*form_subβwin(3FORM)form_termβhook(3FORM)form_userptrβuserptr(3FORM)form_winβwin(3FORM)free_fieldβfield_new(3FORM)free_fieldtypeβfieldtype(3FORM)free_formβnew(3FORM)link_fieldβfield_new(3FORM)link_fieldtypeβfieldtype(3FORM)move_fieldβfield(3FORM)new_fieldβfield_new(3FORM)new_fieldtypeβfieldtype(3FORM)new_formβnew(3FORM)new_pageβnew_page(3FORM)pos_form_cursorβcursor(3FORM)post_formβpost(3FORM)scale_formβwin(3FORM)set_current_fieldβpage(3FORM)set_field_backβfield_attributes(3FORM)set_field_bufferβfield_buffer(3FORM)set_field_foreβfield_attributes(3FORM)set_field_initβhook(3FORM)set_field_justβfield_just(3FORM)set_field_optsβfield_opts(3FORM)set_field_padβfield_attributes(3FORM)set_field_statusβfield_buffer(3FORM)set_field_termβhook(3FORM)set_field_typeβfield_validation(3FORM)set_field_userptrβfield_userptr(3FORM)set_fieldtype_argβfieldtype(3FORM)set_fieldtype_choiceβfieldtype(3FORM)set_form_fieldsβfield(3FORM)set_form_initβhook(3FORM)set_form_optsβfield_opts(3FORM)set_form_pageβpage(3FORM)set_form_subβwin(3FORM)set_form_termβhook(3FORM)set_form_userptrβuserptr(3FORM)set_form_winβwin(3FORM)set_max_fieldβfield_buffer(3FORM)set_new_pageβnew_page(3FORM)unfocus_current_fieldβpage(3FORM)*unpost_formβpost(3FORM)
75 entries. she's thorough. we respect it π«Ά
π₯ RETURN VALUE π₯
Routines that return pointers return NULL on error, and set errno to the corresponding error-code returned by functions returning an integer. so: pointer girls give you NULL, and they whisper the real tea into errno.
Routines that return an integer return one of the following error codes:
E_OKβ The routine succeeded. slay β¨E_BAD_ARGUMENTβ Routine detected an incorrect or out-of-range argument. you passed her something cursed πE_BAD_STATEβ Routine was called from an initialization or termination function. wrong place, wrong time, bestie.E_CONNECTEDβ The field is already connected to a form. she's taken πE_INVALID_FIELDβ Contents of a field are not valid. that data is not passing the vibe check.E_NOT_CONNECTEDβ No fields are connected to the form. the group chat is empty πE_NOT_POSTEDβ The form has not been posted. nothing to see here yet.E_NO_ROOMβ Form is too large for its window. she does not fit, no matter how much she sucks in.E_POSTEDβ The form is already posted. she's out there living her life already.E_REQUEST_DENIEDβ The form driver could not process the request.E_SYSTEM_ERRORβ System error occurred (seeerrno(3)).E_UNKNOWN_COMMANDβ The form driver code saw an unknown request code.
π NOTES π
The header file form.h itself includes curses.h. so you don't have to, but you can. she's self-sufficient like that π
π 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 to ancient Unix, pack your own forms.
A form facility was documented in SVr4.2's Character User Interface Programming document. she has receipts π
It is not part of X/Open Curses. nope. not on the list.
Aside from ncurses, there are few implementations:
- systems based on SVr4 source code, e.g., Solaris. π
- NetBSD curses.
A few functions in this implementation are extensions added for ncurses, but not provided by other implementations, e.g., form_driver_w, unfocus_current_field. those two are ncurses originals, iykyk β¨
π AUTHORS π
Juergen Pfeifer. Manual pages and adaptation for ncurses by Eric S. Raymond.
(the legends themselves. we say thank you π«Ά)
β SEE ALSO β
ncurses(3NCURSES) and related pages whose names begin βform_β for detailed descriptions of the entry points. go read those next, bestie, that's where the actual deep lore lives π
and that's the whole page!! mwah π this was ncurses 6.6, dated 2025-11-11, and it's the form(3FORM) manual page β go build something cute with it, you're gonna do great πππ¦
π¦ 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-2024,2025 Thomas E. Dickey
- Copyright 1998-2016,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