xref: /openbsd/lib/libform/fld_info.c (revision 133306f0)
1 /*	$OpenBSD: fld_info.c,v 1.4 2001/01/22 18:02:12 millert Exp $	*/
2 
3 /****************************************************************************
4  * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
5  *                                                                          *
6  * Permission is hereby granted, free of charge, to any person obtaining a  *
7  * copy of this software and associated documentation files (the            *
8  * "Software"), to deal in the Software without restriction, including      *
9  * without limitation the rights to use, copy, modify, merge, publish,      *
10  * distribute, distribute with modifications, sublicense, and/or sell       *
11  * copies of the Software, and to permit persons to whom the Software is    *
12  * furnished to do so, subject to the following conditions:                 *
13  *                                                                          *
14  * The above copyright notice and this permission notice shall be included  *
15  * in all copies or substantial portions of the Software.                   *
16  *                                                                          *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24  *                                                                          *
25  * Except as contained in this notice, the name(s) of the above copyright   *
26  * holders shall not be used in advertising or otherwise to promote the     *
27  * sale, use or other dealings in this Software without prior written       *
28  * authorization.                                                           *
29  ****************************************************************************/
30 
31 /****************************************************************************
32  *   Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997            *
33  ****************************************************************************/
34 
35 #include "form.priv.h"
36 
37 MODULE_ID("$From: fld_info.c,v 1.5 2000/12/10 02:09:38 tom Exp $")
38 
39 /*---------------------------------------------------------------------------
40 |   Facility      :  libnform
41 |   Function      :  int field_info(const FIELD *field,
42 |                                   int *rows, int *cols,
43 |                                   int *frow, int *fcol,
44 |                                   int *nrow, int *nbuf)
45 |
46 |   Description   :  Retrieve infos about the fields creation parameters.
47 |
48 |   Return Values :  E_OK           - success
49 |                    E_BAD_ARGUMENT - invalid field pointer
50 +--------------------------------------------------------------------------*/
51 NCURSES_EXPORT(int)
52 field_info
53     (const FIELD *field,
54      int *rows, int *cols,
55      int *frow, int *fcol,
56      int *nrow, int *nbuf)
57 {
58   if (!field)
59     RETURN(E_BAD_ARGUMENT);
60 
61   if (rows) *rows = field->rows;
62   if (cols) *cols = field->cols;
63   if (frow) *frow = field->frow;
64   if (fcol) *fcol = field->fcol;
65   if (nrow) *nrow = field->nrow;
66   if (nbuf) *nbuf = field->nbuf;
67   RETURN(E_OK);
68 }
69 
70 /*---------------------------------------------------------------------------
71 |   Facility      :  libnform
72 |   Function      :  int dynamic_field_info(const FIELD *field,
73 |                                           int *drows, int *dcols,
74 |                                           int *maxgrow)
75 |
76 |   Description   :  Retrieve informations about a dynamic fields current
77 |                    dynamic parameters.
78 |
79 |   Return Values :  E_OK           - success
80 |                    E_BAD_ARGUMENT - invalid argument
81 +--------------------------------------------------------------------------*/
82 NCURSES_EXPORT(int)
83 dynamic_field_info
84 (const FIELD *field, int *drows, int *dcols, int *maxgrow)
85 {
86   if (!field)
87     RETURN(E_BAD_ARGUMENT);
88 
89   if (drows)   *drows   = field->drows;
90   if (dcols)   *dcols   = field->dcols;
91   if (maxgrow) *maxgrow = field->maxgrow;
92 
93   RETURN(E_OK);
94 }
95 
96 /* fld_info.c ends here */
97