xref: /illumos-gate/usr/src/lib/libxcurses/src/libc/xcurses/attr_on.c (revision 4c87aefe8930bd07275b8dd2e96ea5f24d93a52e)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1995, by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30  * attr_on.c
31  *
32  * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved.
33  *
34  */
35 
36 #ifdef M_RCSID
37 #ifndef lint
38 static char rcsID[] = "$Header: /rd/src/libc/xcurses/rcs/attr_on.c 1.5 1995/07/10 16:09:09 ant Exp $";
39 #endif
40 #endif
41 
42 #include <private.h>
43 
44 int
45 (attr_on)(attr_t at, void *opts)
46 {
47 #ifdef M_CURSES_TRACE
48         __m_trace("attr_on(%x, %p)", at, opts);
49 #endif
50 
51 	stdscr->_fg._at |= at;
52 
53 	return __m_return_code("attr_on", OK);
54 }
55 
56 int
57 (attr_off)(attr_t at, void *opts)
58 {
59 #ifdef M_CURSES_TRACE
60         __m_trace("attr_off(%x, %p)", at, opts);
61 #endif
62 
63 	stdscr->_fg._at &= ~at;
64 
65 	return __m_return_code("attr_off", OK);
66 }
67 
68 int
69 (attr_set)(attr_t at, short co, void *opts)
70 {
71 #ifdef M_CURSES_TRACE
72         __m_trace("attr_set(%x, %d, %p)", at, co, opts);
73 #endif
74 
75 	stdscr->_fg._co = co;
76 	stdscr->_fg._at = at;
77 
78 	return __m_return_code("attr_set", OK);
79 }
80 
81 int
82 (color_set)(short co, void *opts)
83 {
84 #ifdef M_CURSES_TRACE
85         __m_trace("color_set(%d, %p)", co, opts);
86 #endif
87 
88 	stdscr->_fg._co = co;
89 
90 	return __m_return_code("color_set", OK);
91 }
92 
93 int
94 (attr_get)(attr_t *at, short *co, void *opts)
95 {
96 #ifdef M_CURSES_TRACE
97         __m_trace("attr_get(%p, %p, %p)", at, co, opts);
98 #endif
99 
100 	if (at != (attr_t *) 0)
101 		*at = stdscr->_fg._at;
102 
103 	if (co != (short *) 0)
104 		*co = stdscr->_fg._co;
105 
106 	return __m_return_int("attr_get", OK);
107 }
108 
109 int
110 (standout)()
111 {
112 #ifdef M_CURSES_TRACE
113         __m_trace("standout(void)");
114 #endif
115 
116 	stdscr->_fg._at |= WA_STANDOUT;
117 
118 	return __m_return_int("standout", 1);
119 }
120 
121 int
122 (standend)()
123 {
124 #ifdef M_CURSES_TRACE
125         __m_trace("standend(void)");
126 #endif
127 
128 	stdscr->_fg._at = WA_NORMAL;
129 
130 	return __m_return_int("standend", 1);
131 }
132 
133