form_field_buffer.3x 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. '\" t
  2. .\"***************************************************************************
  3. .\" Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
  4. .\" *
  5. .\" Permission is hereby granted, free of charge, to any person obtaining a *
  6. .\" copy of this software and associated documentation files (the *
  7. .\" "Software"), to deal in the Software without restriction, including *
  8. .\" without limitation the rights to use, copy, modify, merge, publish, *
  9. .\" distribute, distribute with modifications, sublicense, and/or sell *
  10. .\" copies of the Software, and to permit persons to whom the Software is *
  11. .\" furnished to do so, subject to the following conditions: *
  12. .\" *
  13. .\" The above copyright notice and this permission notice shall be included *
  14. .\" in all copies or substantial portions of the Software. *
  15. .\" *
  16. .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
  17. .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
  18. .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
  19. .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
  20. .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
  21. .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
  22. .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
  23. .\" *
  24. .\" Except as contained in this notice, the name(s) of the above copyright *
  25. .\" holders shall not be used in advertising or otherwise to promote the *
  26. .\" sale, use or other dealings in this Software without prior written *
  27. .\" authorization. *
  28. .\"***************************************************************************
  29. .\"
  30. .\" $Id: form_field_buffer.3x,v 1.15 2008/10/18 18:35:17 tom Exp $
  31. .TH form_field_buffer 3X ""
  32. .SH NAME
  33. \fBform_field_buffer\fR - field buffer control
  34. .SH SYNOPSIS
  35. \fB#include <form.h>\fR
  36. .br
  37. int set_field_buffer(FIELD *field, int buf, const char *value);
  38. .br
  39. char *field_buffer(const FIELD *field, int buffer);
  40. .br
  41. int set_field_status(FIELD *field, bool status);
  42. .br
  43. bool field_status(const FIELD *field);
  44. .br
  45. int set_max_field(FIELD *field, int max);
  46. .br
  47. .SH DESCRIPTION
  48. The function \fBset_field_buffer\fR sets the numbered buffer of the given field
  49. to contain a given string:
  50. .RS 3
  51. .TP 3
  52. -
  53. Buffer 0 is the displayed value of the field.
  54. .TP 3
  55. -
  56. Other numbered buffers may be allocated by applications through the \fBnbuf\fR
  57. argument of (see \fBform_field_new\fR(3X))
  58. but are not manipulated by the forms library.
  59. .RE
  60. .PP
  61. The function \fBfield_buffer\fR returns a pointer to
  62. the contents of the given numbered buffer:
  63. .RS 3
  64. .TP 3
  65. -
  66. The buffer contents always have the same length,
  67. and are padded with trailing spaces
  68. as needed to ensure this length is the same.
  69. .TP 3
  70. -
  71. The buffer may contain leading spaces, depending on how it was set.
  72. .TP 3
  73. -
  74. The buffer contents are set with \fBset_field_buffer\fP,
  75. or as a side effect of any editing operations on the corresponding field.
  76. .TP 3
  77. -
  78. Editing operations are based on the \fIwindow\fP which displays the field,
  79. rather than a \fIstring\fP.
  80. The window contains only printable characters, and is filled with blanks.
  81. If you want the raw data, you must write your
  82. own routine that copies the value out of the buffer and removes the leading
  83. and trailing spaces.
  84. .TP 3
  85. -
  86. Because editing operations change the content of the buffer to
  87. correspond to the window, you should not rely on using buffers
  88. for long-term storage of form data.
  89. .RE
  90. .PP
  91. The function \fBset_field_status\fR sets the associated status flag of
  92. \fIfield\fR; \fBfield_status\fR gets the current value. The status flag
  93. is set to a nonzero value whenever the field changes.
  94. .PP
  95. The function \fBset_max_field\fR sets the maximum size for a dynamic field.
  96. An argument of 0 turns off any maximum size threshold for that field.
  97. .SH RETURN VALUE
  98. The \fBfield_buffer\fR function returns NULL on error.
  99. It sets errno according to their success:
  100. .TP 5
  101. .B E_OK
  102. The routine succeeded.
  103. .TP 5
  104. .B E_BAD_ARGUMENT
  105. Routine detected an incorrect or out-of-range argument.
  106. .PP
  107. The \fBfield_status\fR function returns \fBTRUE\fR or \fBFALSE\fR.
  108. .PP
  109. The remaining routines return one of the following:
  110. .TP 5
  111. .B E_OK
  112. The routine succeeded.
  113. .TP 5
  114. .B E_SYSTEM_ERROR
  115. System error occurred (see \fBerrno\fR).
  116. .TP 5
  117. .B E_BAD_ARGUMENT
  118. Routine detected an incorrect or out-of-range argument.
  119. .SH SEE ALSO
  120. \fBcurses\fR(3X) and related pages whose names begin "form_" for detailed
  121. descriptions of the entry points.
  122. .SH NOTES
  123. The header file \fB<form.h>\fR automatically includes the header file
  124. .PP
  125. When configured for wide-characters, \fBfield_buffer\fP returns a pointer
  126. to temporary storage (allocated and freed by the library).
  127. The application should not attempt to modify the data.
  128. It will be freed on the next call to \fBfield_buffer\fP to return the
  129. same buffer.
  130. \fB<curses.h>\fR.
  131. .SH PORTABILITY
  132. These routines emulate the System V forms library. They were not supported on
  133. Version 7 or BSD versions.
  134. .SH AUTHORS
  135. Juergen Pfeifer. Manual pages and adaptation for new curses by Eric
  136. S. Raymond.
  137. .\"#
  138. .\"# The following sets edit modes for GNU EMACS
  139. .\"# Local Variables:
  140. .\"# mode:nroff
  141. .\"# fill-column:79
  142. .\"# End: