xref: /openbsd/lib/libform/fld_stat.c (revision 07ea8d15)
1 
2 /***************************************************************************
3 *                            COPYRIGHT NOTICE                              *
4 ****************************************************************************
5 *                ncurses is copyright (C) 1992-1995                        *
6 *                          Zeyd M. Ben-Halim                               *
7 *                          zmbenhal@netcom.com                             *
8 *                          Eric S. Raymond                                 *
9 *                          esr@snark.thyrsus.com                           *
10 *                                                                          *
11 *        Permission is hereby granted to reproduce and distribute ncurses  *
12 *        by any means and for any fee, whether alone or as part of a       *
13 *        larger distribution, in source or in binary form, PROVIDED        *
14 *        this notice is included with any such distribution, and is not    *
15 *        removed from any of its header files. Mention of ncurses in any   *
16 *        applications linked with it is highly appreciated.                *
17 *                                                                          *
18 *        ncurses comes AS IS with no warranty, implied or expressed.       *
19 *                                                                          *
20 ***************************************************************************/
21 
22 #include "form.priv.h"
23 
24 /*---------------------------------------------------------------------------
25 |   Facility      :  libnform
26 |   Function      :  int set_field_status(FIELD *field, bool status)
27 |
28 |   Description   :  Set or clear the 'changed' indication flag for that
29 |                    fields primary buffer.
30 |
31 |   Return Values :  E_OK            - success
32 +--------------------------------------------------------------------------*/
33 int set_field_status(FIELD * field, bool status)
34 {
35   Normalize_Field( field );
36 
37   if (status)
38     field->status |= _CHANGED;
39   else
40     field->status &= ~_CHANGED;
41 
42   return(E_OK);
43 }
44 
45 /*---------------------------------------------------------------------------
46 |   Facility      :  libnform
47 |   Function      :  bool field_status(const FIELD *field)
48 |
49 |   Description   :  Retrieve the value of the 'changed' indication flag
50 |                    for that fields primary buffer.
51 |
52 |   Return Values :  TRUE  - buffer has been changed
53 |                    FALSE - buffer has not been changed
54 +--------------------------------------------------------------------------*/
55 bool field_status(const FIELD * field)
56 {
57   return ((Normalize_Field(field)->status & _CHANGED) ? TRUE : FALSE);
58 }
59 
60 /* fld_stat.c ends here */
61