1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1995, by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate /*
30*7c478bd9Sstevel@tonic-gate  * vid_puts.c
31*7c478bd9Sstevel@tonic-gate  *
32*7c478bd9Sstevel@tonic-gate  * XCurses Library
33*7c478bd9Sstevel@tonic-gate  *
34*7c478bd9Sstevel@tonic-gate  * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved.
35*7c478bd9Sstevel@tonic-gate  *
36*7c478bd9Sstevel@tonic-gate  */
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate #ifdef M_RCSID
39*7c478bd9Sstevel@tonic-gate #ifndef lint
40*7c478bd9Sstevel@tonic-gate static char rcsID[] = "$Header: /rd/src/libc/xcurses/rcs/vid_puts.c 1.5 1995/07/19 16:38:26 ant Exp $";
41*7c478bd9Sstevel@tonic-gate #endif
42*7c478bd9Sstevel@tonic-gate #endif
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate #include <private.h>
45*7c478bd9Sstevel@tonic-gate #include <limits.h>
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate STATIC attr_t turn_off(int (*)(int), attr_t);
48*7c478bd9Sstevel@tonic-gate STATIC attr_t turn_on(int (*)(int), attr_t);
49*7c478bd9Sstevel@tonic-gate 
50*7c478bd9Sstevel@tonic-gate /*
51*7c478bd9Sstevel@tonic-gate  * Return true if attribute X a member of the attribute set A.
52*7c478bd9Sstevel@tonic-gate  * no_color_video is the set of attributes that cannot be combined
53*7c478bd9Sstevel@tonic-gate  * with colours.
54*7c478bd9Sstevel@tonic-gate  */
55*7c478bd9Sstevel@tonic-gate #define ISATTR(a,x)	(((a) & ~no_color_video & (x)) == (x))
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate /*f
58*7c478bd9Sstevel@tonic-gate  * Set the desired attribute state for a terminal screen.
59*7c478bd9Sstevel@tonic-gate  *
60*7c478bd9Sstevel@tonic-gate  * Using set_attributes is the prefered method but requires some care
61*7c478bd9Sstevel@tonic-gate  * in writing the proper terminfo string.  Using exit_attribute_mode and
62*7c478bd9Sstevel@tonic-gate  * the assorted enter_ attribute mode capabilities is the next best method.
63*7c478bd9Sstevel@tonic-gate  * Finally using the assorted exit_ and enter_ attribute mode capabilities
64*7c478bd9Sstevel@tonic-gate  * is the last method available and is not necessarily efficent (or smart
65*7c478bd9Sstevel@tonic-gate  * because of the needs of ceol_standout_glitch support).
66*7c478bd9Sstevel@tonic-gate  */
67*7c478bd9Sstevel@tonic-gate int
68*7c478bd9Sstevel@tonic-gate vid_puts(attr_t attr, short pair, void *opts, int (*putout)(int))
69*7c478bd9Sstevel@tonic-gate {
70*7c478bd9Sstevel@tonic-gate #ifdef M_CURSES_TRACE
71*7c478bd9Sstevel@tonic-gate 	__m_trace("vid_puts(%x, %d, %p, %p)", attr, pair, opts, putout);
72*7c478bd9Sstevel@tonic-gate #endif
73*7c478bd9Sstevel@tonic-gate 
74*7c478bd9Sstevel@tonic-gate 	if (set_attributes != (char *) 0 && ATTR_STATE != attr) {
75*7c478bd9Sstevel@tonic-gate 		/* Assume that <set_attributes> disables attributes
76*7c478bd9Sstevel@tonic-gate 		 * then re-enables attributes that are to be on.
77*7c478bd9Sstevel@tonic-gate 		 */
78*7c478bd9Sstevel@tonic-gate 		(void) tputs(
79*7c478bd9Sstevel@tonic-gate 			tparm(
80*7c478bd9Sstevel@tonic-gate 				set_attributes,
81*7c478bd9Sstevel@tonic-gate 				(long) ISATTR(attr, WA_STANDOUT),
82*7c478bd9Sstevel@tonic-gate 				(long) ISATTR(attr, WA_UNDERLINE),
83*7c478bd9Sstevel@tonic-gate 				(long) ISATTR(attr, WA_REVERSE),
84*7c478bd9Sstevel@tonic-gate 				(long) ISATTR(attr, WA_BLINK),
85*7c478bd9Sstevel@tonic-gate 				(long) ISATTR(attr, WA_DIM),
86*7c478bd9Sstevel@tonic-gate 				(long) ISATTR(attr, WA_BOLD),
87*7c478bd9Sstevel@tonic-gate 				(long) ISATTR(attr, WA_INVIS),
88*7c478bd9Sstevel@tonic-gate 				(long) ISATTR(attr, WA_PROTECT),
89*7c478bd9Sstevel@tonic-gate 				(long) ISATTR(attr, WA_ALTCHARSET)
90*7c478bd9Sstevel@tonic-gate 			),
91*7c478bd9Sstevel@tonic-gate 			1, putout
92*7c478bd9Sstevel@tonic-gate 		);
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate 		ATTR_STATE &= ~WA_SGR_MASK;
95*7c478bd9Sstevel@tonic-gate 		ATTR_STATE |= attr & WA_SGR_MASK;
96*7c478bd9Sstevel@tonic-gate 
97*7c478bd9Sstevel@tonic-gate 		/* Only use <set_a_attributes> when <set_attributes>
98*7c478bd9Sstevel@tonic-gate 		 * is defined.  <set_a_attributes> should not disable
99*7c478bd9Sstevel@tonic-gate 		 * attributes, as this will have been handled by
100*7c478bd9Sstevel@tonic-gate 		 * <set_attributes>.
101*7c478bd9Sstevel@tonic-gate 		 */
102*7c478bd9Sstevel@tonic-gate 		if (set_a_attributes != (char *) 0 && (attr & WA_SGR1_MASK)) {
103*7c478bd9Sstevel@tonic-gate 			(void) tputs(
104*7c478bd9Sstevel@tonic-gate 				tparm(
105*7c478bd9Sstevel@tonic-gate 					set_a_attributes,
106*7c478bd9Sstevel@tonic-gate 					(long) ISATTR(attr, WA_HORIZONTAL),
107*7c478bd9Sstevel@tonic-gate 					(long) ISATTR(attr, WA_LEFT),
108*7c478bd9Sstevel@tonic-gate 					(long) ISATTR(attr, WA_LOW),
109*7c478bd9Sstevel@tonic-gate 					(long) ISATTR(attr, WA_RIGHT),
110*7c478bd9Sstevel@tonic-gate 					(long) ISATTR(attr, WA_TOP),
111*7c478bd9Sstevel@tonic-gate 					(long) ISATTR(attr, WA_VERTICAL),
112*7c478bd9Sstevel@tonic-gate 					0L, 0L, 0L
113*7c478bd9Sstevel@tonic-gate 				),
114*7c478bd9Sstevel@tonic-gate 				1, putout
115*7c478bd9Sstevel@tonic-gate 			);
116*7c478bd9Sstevel@tonic-gate 
117*7c478bd9Sstevel@tonic-gate 			ATTR_STATE &= ~WA_SGR1_MASK;
118*7c478bd9Sstevel@tonic-gate 			ATTR_STATE |= attr & WA_SGR1_MASK;
119*7c478bd9Sstevel@tonic-gate 		}
120*7c478bd9Sstevel@tonic-gate 	} else if (ATTR_STATE != attr) {
121*7c478bd9Sstevel@tonic-gate 		/* Turn off only those attributes that are on. */
122*7c478bd9Sstevel@tonic-gate 		(void) turn_off(putout, ATTR_STATE);
123*7c478bd9Sstevel@tonic-gate 
124*7c478bd9Sstevel@tonic-gate 		/* Turn on attributes regardless if they are already
125*7c478bd9Sstevel@tonic-gate 		 * on, because terminals with ceol_standout_glitch, like
126*7c478bd9Sstevel@tonic-gate 		 * HP terminals, will have to re-enforce the current
127*7c478bd9Sstevel@tonic-gate 		 * attributes in order to change existing attribute
128*7c478bd9Sstevel@tonic-gate 		 * cookies on the screen.
129*7c478bd9Sstevel@tonic-gate 		 */
130*7c478bd9Sstevel@tonic-gate 		ATTR_STATE = turn_on(putout, attr);
131*7c478bd9Sstevel@tonic-gate 	}
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate 	/* A_NORMAL equals 0, which is all attributes off and
134*7c478bd9Sstevel@tonic-gate 	 * COLOR_PAIR(0).  This implies that colour pair 0 is
135*7c478bd9Sstevel@tonic-gate 	 * the orig_pair.
136*7c478bd9Sstevel@tonic-gate 	 */
137*7c478bd9Sstevel@tonic-gate 	if (attr == WA_NORMAL) {
138*7c478bd9Sstevel@tonic-gate 		if (orig_pair != (char *) 0)
139*7c478bd9Sstevel@tonic-gate 			(void) tputs(orig_pair, 1, putout);
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate 		pair = 0;
142*7c478bd9Sstevel@tonic-gate 	} else if (pair != cur_term->_co && 0 < max_colors) {
143*7c478bd9Sstevel@tonic-gate 		short fg, bg;
144*7c478bd9Sstevel@tonic-gate 
145*7c478bd9Sstevel@tonic-gate 		if (set_color_pair != (char *) 0) {
146*7c478bd9Sstevel@tonic-gate 			(void) tputs(
147*7c478bd9Sstevel@tonic-gate 				tparm(
148*7c478bd9Sstevel@tonic-gate 					set_color_pair, (long) pair,
149*7c478bd9Sstevel@tonic-gate 					0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L
150*7c478bd9Sstevel@tonic-gate 				),
151*7c478bd9Sstevel@tonic-gate 				1, putout
152*7c478bd9Sstevel@tonic-gate 			);
153*7c478bd9Sstevel@tonic-gate 		} else if (pair_content(pair, &fg, &bg) == OK) {
154*7c478bd9Sstevel@tonic-gate 			if (set_foreground != (char *) 0) {
155*7c478bd9Sstevel@tonic-gate 				(void) tputs(
156*7c478bd9Sstevel@tonic-gate 					tparm(set_foreground, (long) fg,
157*7c478bd9Sstevel@tonic-gate 						0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L
158*7c478bd9Sstevel@tonic-gate 					),
159*7c478bd9Sstevel@tonic-gate 					1, putout
160*7c478bd9Sstevel@tonic-gate 				);
161*7c478bd9Sstevel@tonic-gate 			} else if (set_a_foreground != (char *) 0) {
162*7c478bd9Sstevel@tonic-gate 				(void) tputs(
163*7c478bd9Sstevel@tonic-gate 					tparm(
164*7c478bd9Sstevel@tonic-gate 						set_a_foreground, (long) fg,
165*7c478bd9Sstevel@tonic-gate 						0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L
166*7c478bd9Sstevel@tonic-gate 					),
167*7c478bd9Sstevel@tonic-gate 					1, putout
168*7c478bd9Sstevel@tonic-gate 				);
169*7c478bd9Sstevel@tonic-gate 			}
170*7c478bd9Sstevel@tonic-gate 
171*7c478bd9Sstevel@tonic-gate 			if (set_background != (char *) 0) {
172*7c478bd9Sstevel@tonic-gate 				(void) tputs(
173*7c478bd9Sstevel@tonic-gate 					tparm(set_background, (long) bg,
174*7c478bd9Sstevel@tonic-gate 						0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L
175*7c478bd9Sstevel@tonic-gate 					),
176*7c478bd9Sstevel@tonic-gate 					1, putout
177*7c478bd9Sstevel@tonic-gate 				);
178*7c478bd9Sstevel@tonic-gate 			} else if (set_a_background != (char *) 0) {
179*7c478bd9Sstevel@tonic-gate 				(void) tputs(
180*7c478bd9Sstevel@tonic-gate 					tparm(
181*7c478bd9Sstevel@tonic-gate 						set_a_background, (long) bg,
182*7c478bd9Sstevel@tonic-gate 						0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L
183*7c478bd9Sstevel@tonic-gate 					),
184*7c478bd9Sstevel@tonic-gate 					1, putout
185*7c478bd9Sstevel@tonic-gate 				);
186*7c478bd9Sstevel@tonic-gate 			}
187*7c478bd9Sstevel@tonic-gate 		}
188*7c478bd9Sstevel@tonic-gate 	}
189*7c478bd9Sstevel@tonic-gate 
190*7c478bd9Sstevel@tonic-gate 	/* Remember the current attribute state for the terminal. */
191*7c478bd9Sstevel@tonic-gate 	ATTR_STATE = attr;
192*7c478bd9Sstevel@tonic-gate 	cur_term->_co = pair;
193*7c478bd9Sstevel@tonic-gate 
194*7c478bd9Sstevel@tonic-gate 	return __m_return_code("vid_puts", OK);
195*7c478bd9Sstevel@tonic-gate }
196*7c478bd9Sstevel@tonic-gate 
197*7c478bd9Sstevel@tonic-gate STATIC attr_t
198*7c478bd9Sstevel@tonic-gate turn_off(int (*putout)(int), attr_t attr)
199*7c478bd9Sstevel@tonic-gate {
200*7c478bd9Sstevel@tonic-gate 	attr_t new = attr;
201*7c478bd9Sstevel@tonic-gate 
202*7c478bd9Sstevel@tonic-gate 	if (exit_attribute_mode != (char *) 0) {
203*7c478bd9Sstevel@tonic-gate 		(void) tputs(exit_attribute_mode, 1, putout);
204*7c478bd9Sstevel@tonic-gate 		new = WA_NORMAL;
205*7c478bd9Sstevel@tonic-gate 	} else {
206*7c478bd9Sstevel@tonic-gate 		if (ISATTR(attr, WA_UNDERLINE)
207*7c478bd9Sstevel@tonic-gate 		&& exit_underline_mode != (char *) 0) {
208*7c478bd9Sstevel@tonic-gate 			(void) tputs(exit_underline_mode, 1, putout);
209*7c478bd9Sstevel@tonic-gate 			new &= ~WA_UNDERLINE;
210*7c478bd9Sstevel@tonic-gate 		}
211*7c478bd9Sstevel@tonic-gate 
212*7c478bd9Sstevel@tonic-gate 		if (ISATTR(attr, WA_STANDOUT)
213*7c478bd9Sstevel@tonic-gate 		&& exit_standout_mode != (char *) 0) {
214*7c478bd9Sstevel@tonic-gate 			(void) tputs(exit_standout_mode, 1, putout);
215*7c478bd9Sstevel@tonic-gate 			new &= ~WA_STANDOUT;
216*7c478bd9Sstevel@tonic-gate 		}
217*7c478bd9Sstevel@tonic-gate 
218*7c478bd9Sstevel@tonic-gate 		if (ISATTR(attr, WA_ALTCHARSET)
219*7c478bd9Sstevel@tonic-gate 		&& exit_alt_charset_mode != (char *) 0) {
220*7c478bd9Sstevel@tonic-gate 			(void) tputs(exit_alt_charset_mode, 1, putout);
221*7c478bd9Sstevel@tonic-gate 			new &= ~WA_ALTCHARSET;
222*7c478bd9Sstevel@tonic-gate 		}
223*7c478bd9Sstevel@tonic-gate 	}
224*7c478bd9Sstevel@tonic-gate 
225*7c478bd9Sstevel@tonic-gate 	return new;
226*7c478bd9Sstevel@tonic-gate }
227*7c478bd9Sstevel@tonic-gate 
228*7c478bd9Sstevel@tonic-gate STATIC attr_t
229*7c478bd9Sstevel@tonic-gate turn_on(int (*putout)(int), attr_t attr)
230*7c478bd9Sstevel@tonic-gate {
231*7c478bd9Sstevel@tonic-gate 	attr_t new = attr;
232*7c478bd9Sstevel@tonic-gate 
233*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_ALTCHARSET)
234*7c478bd9Sstevel@tonic-gate 	&& enter_alt_charset_mode != (char *) 0) {
235*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_alt_charset_mode, 1, putout);
236*7c478bd9Sstevel@tonic-gate 		new |= WA_ALTCHARSET;
237*7c478bd9Sstevel@tonic-gate 	}
238*7c478bd9Sstevel@tonic-gate 
239*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_BLINK) && enter_blink_mode != (char *) 0) {
240*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_blink_mode, 1, putout);
241*7c478bd9Sstevel@tonic-gate 		new |= WA_BLINK;
242*7c478bd9Sstevel@tonic-gate 	}
243*7c478bd9Sstevel@tonic-gate 
244*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_BOLD) && enter_bold_mode != (char *) 0) {
245*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_bold_mode, 1, putout);
246*7c478bd9Sstevel@tonic-gate 		new |= WA_BOLD;
247*7c478bd9Sstevel@tonic-gate 	}
248*7c478bd9Sstevel@tonic-gate 
249*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_INVIS) && enter_secure_mode != (char *) 0) {
250*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_secure_mode, 1, putout);
251*7c478bd9Sstevel@tonic-gate 		new |= WA_INVIS;
252*7c478bd9Sstevel@tonic-gate 	}
253*7c478bd9Sstevel@tonic-gate 
254*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_DIM) && enter_dim_mode != (char *) 0) {
255*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_dim_mode, 1, putout);
256*7c478bd9Sstevel@tonic-gate 		new |= WA_DIM;
257*7c478bd9Sstevel@tonic-gate 	}
258*7c478bd9Sstevel@tonic-gate 
259*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_PROTECT) && enter_protected_mode != (char *) 0) {
260*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_protected_mode, 1, putout);
261*7c478bd9Sstevel@tonic-gate 		new |= WA_PROTECT;
262*7c478bd9Sstevel@tonic-gate 	}
263*7c478bd9Sstevel@tonic-gate 
264*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_REVERSE) && enter_reverse_mode != (char *) 0) {
265*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_reverse_mode, 1, putout);
266*7c478bd9Sstevel@tonic-gate 		new |= WA_REVERSE;
267*7c478bd9Sstevel@tonic-gate 	}
268*7c478bd9Sstevel@tonic-gate 
269*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_STANDOUT) && enter_standout_mode != (char *) 0) {
270*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_standout_mode, 1, putout);
271*7c478bd9Sstevel@tonic-gate 		new |= WA_STANDOUT;
272*7c478bd9Sstevel@tonic-gate 	}
273*7c478bd9Sstevel@tonic-gate 
274*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_UNDERLINE) && enter_underline_mode != (char *) 0) {
275*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_underline_mode, 1, putout);
276*7c478bd9Sstevel@tonic-gate 		new |= WA_UNDERLINE;
277*7c478bd9Sstevel@tonic-gate 	}
278*7c478bd9Sstevel@tonic-gate 
279*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_HORIZONTAL)
280*7c478bd9Sstevel@tonic-gate 	&& enter_horizontal_hl_mode != (char *) 0) {
281*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_horizontal_hl_mode, 1, putout);
282*7c478bd9Sstevel@tonic-gate 		new |= WA_HORIZONTAL;
283*7c478bd9Sstevel@tonic-gate 	}
284*7c478bd9Sstevel@tonic-gate 
285*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_LEFT) && enter_left_hl_mode != (char *) 0) {
286*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_left_hl_mode, 1, putout);
287*7c478bd9Sstevel@tonic-gate 		new |= WA_LEFT;
288*7c478bd9Sstevel@tonic-gate 	}
289*7c478bd9Sstevel@tonic-gate 
290*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_LOW) && enter_low_hl_mode != (char *) 0) {
291*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_low_hl_mode, 1, putout);
292*7c478bd9Sstevel@tonic-gate 		new |= WA_LOW;
293*7c478bd9Sstevel@tonic-gate 	}
294*7c478bd9Sstevel@tonic-gate 
295*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_RIGHT) && enter_right_hl_mode != (char *) 0) {
296*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_right_hl_mode, 1, putout);
297*7c478bd9Sstevel@tonic-gate 		new |= WA_RIGHT;
298*7c478bd9Sstevel@tonic-gate 	}
299*7c478bd9Sstevel@tonic-gate 
300*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_TOP) && enter_top_hl_mode != (char *) 0) {
301*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_top_hl_mode, 1, putout);
302*7c478bd9Sstevel@tonic-gate 		new |= WA_TOP;
303*7c478bd9Sstevel@tonic-gate 	}
304*7c478bd9Sstevel@tonic-gate 
305*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_VERTICAL) && enter_vertical_hl_mode != (char *) 0) {
306*7c478bd9Sstevel@tonic-gate 		(void) tputs(enter_vertical_hl_mode, 1, putout);
307*7c478bd9Sstevel@tonic-gate 		new |= WA_VERTICAL;
308*7c478bd9Sstevel@tonic-gate 	}
309*7c478bd9Sstevel@tonic-gate 
310*7c478bd9Sstevel@tonic-gate 	return new;
311*7c478bd9Sstevel@tonic-gate }
312*7c478bd9Sstevel@tonic-gate 
313