GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: lib/libform/frm_opts.c Lines: 0 16 0.0 %
Date: 2017-11-07 Branches: 0 6 0.0 %

Line Branch Exec Source
1
/*	$OpenBSD: frm_opts.c,v 1.9 2015/01/23 22:48:51 krw Exp $	*/
2
/****************************************************************************
3
 * Copyright (c) 1998-2004,2005 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
/****************************************************************************
31
 *   Author:  Juergen Pfeifer, 1995,1997                                    *
32
 ****************************************************************************/
33
34
#include "form.priv.h"
35
36
MODULE_ID("$Id: frm_opts.c,v 1.9 2015/01/23 22:48:51 krw Exp $")
37
38
/*---------------------------------------------------------------------------
39
|   Facility      :  libnform
40
|   Function      :  int set_form_opts(FORM *form, Form_Options opts)
41
|
42
|   Description   :  Turns on the named options and turns off all the
43
|                    remaining options for that form.
44
|
45
|   Return Values :  E_OK              - success
46
|                    E_BAD_ARGUMENT    - invalid options
47
+--------------------------------------------------------------------------*/
48
NCURSES_EXPORT(int)
49
set_form_opts(FORM *form, Form_Options opts)
50
{
51
  T((T_CALLED("set_form_opts(%p,%d)"), form, opts));
52
53
  opts &= ALL_FORM_OPTS;
54
  if (opts & ~ALL_FORM_OPTS)
55
    RETURN(E_BAD_ARGUMENT);
56
  else
57
    {
58
      Normalize_Form(form)->opts = opts;
59
      RETURN(E_OK);
60
    }
61
}
62
63
/*---------------------------------------------------------------------------
64
|   Facility      :  libnform
65
|   Function      :  Form_Options form_opts(const FORM *)
66
|
67
|   Description   :  Retrieves the current form options.
68
|
69
|   Return Values :  The option flags.
70
+--------------------------------------------------------------------------*/
71
NCURSES_EXPORT(Form_Options)
72
form_opts(const FORM *form)
73
{
74
  T((T_CALLED("form_opts(%p)"), form));
75
  returnCode((int)(Normalize_Form(form)->opts & ALL_FORM_OPTS));
76
}
77
78
/*---------------------------------------------------------------------------
79
|   Facility      :  libnform
80
|   Function      :  int form_opts_on(FORM *form, Form_Options opts)
81
|
82
|   Description   :  Turns on the named options; no other options are
83
|                    changed.
84
|
85
|   Return Values :  E_OK            - success
86
|                    E_BAD_ARGUMENT  - invalid options
87
+--------------------------------------------------------------------------*/
88
NCURSES_EXPORT(int)
89
form_opts_on(FORM *form, Form_Options opts)
90
{
91
  T((T_CALLED("form_opts_on(%p,%d)"), form, opts));
92
93
  opts &= ALL_FORM_OPTS;
94
  if (opts & ~ALL_FORM_OPTS)
95
    RETURN(E_BAD_ARGUMENT);
96
  else
97
    {
98
      Normalize_Form(form)->opts |= opts;
99
      RETURN(E_OK);
100
    }
101
}
102
103
/*---------------------------------------------------------------------------
104
|   Facility      :  libnform
105
|   Function      :  int form_opts_off(FORM *form, Form_Options opts)
106
|
107
|   Description   :  Turns off the named options; no other options are
108
|                    changed.
109
|
110
|   Return Values :  E_OK            - success
111
|                    E_BAD_ARGUMENT  - invalid options
112
+--------------------------------------------------------------------------*/
113
NCURSES_EXPORT(int)
114
form_opts_off(FORM *form, Form_Options opts)
115
{
116
  T((T_CALLED("form_opts_off(%p,%d)"), form, opts));
117
118
  opts &= ALL_FORM_OPTS;
119
  if (opts & ~ALL_FORM_OPTS)
120
    RETURN(E_BAD_ARGUMENT);
121
  else
122
    {
123
      Normalize_Form(form)->opts &= ~opts;
124
      RETURN(E_OK);
125
    }
126
}
127
128
/* frm_opts.c ends here */