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 (see errno(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