jcs's openbsd hax
openbsd
at jcs 245 lines 8.9 kB view raw
1'\" t 2.\" $OpenBSD: form.3,v 1.7 2023/10/17 09:52:10 nicm Exp $ 3.\" 4.\"*************************************************************************** 5.\" Copyright 2018-2021,2023 Thomas E. Dickey * 6.\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * 7.\" * 8.\" Permission is hereby granted, free of charge, to any person obtaining a * 9.\" copy of this software and associated documentation files (the * 10.\" "Software"), to deal in the Software without restriction, including * 11.\" without limitation the rights to use, copy, modify, merge, publish, * 12.\" distribute, distribute with modifications, sublicense, and/or sell * 13.\" copies of the Software, and to permit persons to whom the Software is * 14.\" furnished to do so, subject to the following conditions: * 15.\" * 16.\" The above copyright notice and this permission notice shall be included * 17.\" in all copies or substantial portions of the Software. * 18.\" * 19.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 20.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 21.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 22.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 23.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 24.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 25.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 26.\" * 27.\" Except as contained in this notice, the name(s) of the above copyright * 28.\" holders shall not be used in advertising or otherwise to promote the * 29.\" sale, use or other dealings in this Software without prior written * 30.\" authorization. * 31.\"*************************************************************************** 32.\" 33.\" $Id: form.3,v 1.7 2023/10/17 09:52:10 nicm Exp $ 34.TH form 3 2023-08-19 "ncurses 6.4" "Library calls" 35.ie \n(.g .ds `` \(lq 36.el .ds `` `` 37.ie \n(.g .ds '' \(rq 38.el .ds '' '' 39.de bP 40.ie n .IP \(bu 4 41.el .IP \(bu 2 42.. 43.SH NAME 44\fBform\fP \- curses extension for programming forms 45.SH SYNOPSIS 46\fB#include <form.h>\fP 47.SH DESCRIPTION 48The \fBform\fP library provides terminal-independent facilities for composing 49form screens on character-cell terminals. 50The library includes: field 51routines, which create and modify form fields; and form routines, which group 52fields into forms, display forms on the screen, and handle interaction with the 53user. 54.PP 55The \fBform\fP library uses the \fBcurses\fP libraries. 56To use the \fBform\fP library, link with the options 57\fB\-lform \-lcurses\fP. 58.PP 59Your program should set up the locale, e.g., 60.sp 61 \fBsetlocale(LC_ALL, "");\fP 62.sp 63so that input/output processing will work. 64.PP 65A curses initialization routine such as \fBinitscr\fP must be called 66before using any of these functions. 67. 68.SS Current Default Values for Field Attributes 69. 70The \fBform\fP library maintains a default value for field attributes. 71You 72can get or set this default by calling the appropriate \fBset_\fP 73or retrieval 74routine with a \fBNULL\fP field pointer. 75Changing this default with a 76\fBset_\fP function affects future field creations, but does not change the 77rendering of fields already created. 78. 79.SS Routine Name Index 80. 81The following table lists each \fBform\fP routine and the name of 82the manual page on which it is described. 83Routines flagged with \*(``*\*('' 84are ncurses-specific, not present in SVr4. 85.PP 86.TS 87l l 88l l . 89\fBcurses\fP Routine Name Manual Page Name 90= 91current_field \fBform_page\fP(3) 92data_ahead \fBform_data\fP(3) 93data_behind \fBform_data\fP(3) 94dup_field \fBform_field_new\fP(3) 95dynamic_field_info \fBform_field_info\fP(3) 96field_arg \fBform_field_validation\fP(3) 97field_back \fBform_field_attributes\fP(3) 98field_buffer \fBform_field_buffer\fP(3) 99field_count \fBform_field\fP(3) 100field_fore \fBform_field_attributes\fP(3) 101field_index \fBform_page\fP(3) 102field_info \fBform_field_info\fP(3) 103field_init \fBform_hook\fP(3) 104field_just \fBform_field_just\fP(3) 105field_opts \fBform_field_opts\fP(3) 106field_opts_off \fBform_field_opts\fP(3) 107field_opts_on \fBform_field_opts\fP(3) 108field_pad \fBform_field_attributes\fP(3) 109field_status \fBform_field_buffer\fP(3) 110field_term \fBform_hook\fP(3) 111field_type \fBform_field_validation\fP(3) 112field_userptr \fBform_field_userptr\fP(3) 113form_driver \fBform_driver\fP(3) 114form_driver_w \fBform_driver\fP(3)* 115form_fields \fBform_field\fP(3) 116form_init \fBform_hook\fP(3) 117form_opts \fBform_opts\fP(3) 118form_opts_off \fBform_opts\fP(3) 119form_opts_on \fBform_opts\fP(3) 120form_page \fBform_page\fP(3) 121form_request_by_name \fBform_requestname\fP(3)* 122form_request_name \fBform_requestname\fP(3)* 123form_sub \fBform_win\fP(3) 124form_term \fBform_hook\fP(3) 125form_userptr \fBform_userptr\fP(3) 126form_win \fBform_win\fP(3) 127free_field \fBform_field_new\fP(3) 128free_fieldtype \fBform_fieldtype\fP(3) 129free_form \fBform_new\fP(3) 130link_field \fBform_field_new\fP(3) 131link_fieldtype \fBform_fieldtype\fP(3) 132move_field \fBform_field\fP(3) 133new_field \fBform_field_new\fP(3) 134new_fieldtype \fBform_fieldtype\fP(3) 135new_form \fBform_new\fP(3) 136new_page \fBform_new_page\fP(3) 137pos_form_cursor \fBform_cursor\fP(3) 138post_form \fBform_post\fP(3) 139scale_form \fBform_win\fP(3) 140set_current_field \fBform_page\fP(3) 141set_field_back \fBform_field_attributes\fP(3) 142set_field_buffer \fBform_field_buffer\fP(3) 143set_field_fore \fBform_field_attributes\fP(3) 144set_field_init \fBform_hook\fP(3) 145set_field_just \fBform_field_just\fP(3) 146set_field_opts \fBform_field_opts\fP(3) 147set_field_pad \fBform_field_attributes\fP(3) 148set_field_status \fBform_field_buffer\fP(3) 149set_field_term \fBform_hook\fP(3) 150set_field_type \fBform_field_validation\fP(3) 151set_field_userptr \fBform_field_userptr\fP(3) 152set_fieldtype_arg \fBform_fieldtype\fP(3) 153set_fieldtype_choice \fBform_fieldtype\fP(3) 154set_form_fields \fBform_field\fP(3) 155set_form_init \fBform_hook\fP(3) 156set_form_opts \fBform_field_opts\fP(3) 157set_form_page \fBform_page\fP(3) 158set_form_sub \fBform_win\fP(3) 159set_form_term \fBform_hook\fP(3) 160set_form_userptr \fBform_userptr\fP(3) 161set_form_win \fBform_win\fP(3) 162set_max_field \fBform_field_buffer\fP(3) 163set_new_page \fBform_new_page\fP(3) 164unfocus_current_field \fBform_page\fP(3)* 165unpost_form \fBform_post\fP(3) 166.TE 167.SH RETURN VALUE 168Routines that return pointers return \fBNULL\fP on error, 169and set \fBerrno\fP to the corresponding error-code returned by functions 170returning an integer. 171Routines that return 172an integer return one of the following error codes: 173.TP 5 174.B E_OK 175The routine succeeded. 176.TP 5 177.B E_BAD_ARGUMENT 178Routine detected an incorrect or out-of-range argument. 179.TP 5 180.B E_BAD_STATE 181Routine was called from an initialization or termination function. 182.TP 5 183.B E_CONNECTED 184The field is already connected to a form. 185.TP 5 186.B E_INVALID_FIELD 187Contents of a field are not valid. 188.TP 5 189.B E_NOT_CONNECTED 190No fields are connected to the form. 191.TP 5 192.B E_NOT_POSTED 193The form has not been posted. 194.TP 5 195.B E_NO_ROOM 196Form is too large for its window. 197.TP 5 198.B E_POSTED 199The form is already posted. 200.TP 5 201.B E_REQUEST_DENIED 202The form driver could not process the request. 203.TP 5 204.B E_SYSTEM_ERROR 205System error occurred (see \fBerrno\fP(3)). 206.TP 5 207.B E_UNKNOWN_COMMAND 208The form driver code saw an unknown request code. 209.SH NOTES 210The header file \fB<form.h>\fP automatically includes the header files 211\fB<curses.h>\fP and \fB<eti.h>\fP. 212.PP 213In your library list, libform.a should be before libncurses.a; that is, 214you want to say \*(``\-lform \-lncurses\*('', not the other way around 215(which would give you a link error when using static libraries). 216.SH PORTABILITY 217These routines emulate the System V forms library. 218They were not supported on 219Version 7 or BSD versions. 220.PP 221The menu facility was documented in SVr4.2 in 222\fICharacter User Interface Programming (UNIX SVR4.2)\fP. 223.PP 224It is not part of X/Open Curses. 225.PP 226Aside from ncurses, there are few implementations: 227.bP 228systems based on SVr4 source code, e.g., Solaris. 229.bP 230NetBSD curses. 231.PP 232A few functions in this implementation are extensions added for ncurses, 233but not provided by other implementations, e.g., 234\fBform_driver_w\fP, 235\fBunfocus_current_field\fP. 236.SH AUTHORS 237Juergen Pfeifer. 238Manual pages and adaptation for ncurses by Eric 239S. Raymond. 240.SH SEE ALSO 241\fBcurses\fP(3) and related pages whose names begin \*(``form_\*('' for detailed 242descriptions of the entry points. 243.PP 244This describes \fBncurses\fP 245version 6.4 (patch 20230826).