xref: /titanic_41/usr/src/lib/libxcurses2/src/libc/xcurses/wbrdr.c (revision 749f21d359d8fbd020c974a1a5227316221bfc9c)
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-1998 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /* LINTLIBRARY */
30 
31 /*
32  * wbrdr.c
33  *
34  * XCurses Library
35  *
36  * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved.
37  *
38  */
39 
40 #ifdef M_RCSID
41 #ifndef lint
42 static char rcsID[] = "$Header: /rd/src/libc/xcurses/rcs/wbrdr.c 1.2 "
43 "1995/07/07 18:53:03 ant Exp $";
44 #endif
45 #endif
46 
47 #include <private.h>
48 
49 /*
50  * Draw a border around the edges of the window. The parms correspond to
51  * a character and attribute for the left, right, top, and bottom sides,
52  * top left, top right, bottom left, and bottom right corners. A zero in
53  * any character parm means to take the default.
54  */
55 int
56 wborder(WINDOW *w,
57 	chtype ls, chtype rs, chtype ts, chtype bs,
58 	chtype tl, chtype tr, chtype bl, chtype br)
59 {
60 	int	code;
61 	cchar_t	wls, wrs, wts, wbs, wtl, wtr, wbl, wbr;
62 
63 	if (ls == 0)
64 		ls = ACS_VLINE;
65 	(void) __m_acs_cc(ls, &wls);
66 
67 	if (rs == 0)
68 		rs = ACS_VLINE;
69 	(void) __m_acs_cc(rs, &wrs);
70 
71 	if (ts == 0)
72 		ts = ACS_HLINE;
73 	(void) __m_acs_cc(ts, &wts);
74 
75 	if (bs == 0)
76 		bs = ACS_HLINE;
77 	(void) __m_acs_cc(bs, &wbs);
78 
79 	if (tl == 0)
80 		tl = ACS_ULCORNER;
81 	(void) __m_acs_cc(tl, &wtl);
82 
83 	if (tr == 0)
84 		tr = ACS_URCORNER;
85 	(void) __m_acs_cc(tr, &wtr);
86 
87 	if (bl == 0)
88 		bl = ACS_LLCORNER;
89 	(void) __m_acs_cc(bl, &wbl);
90 
91 	if (br == 0)
92 		br = ACS_LRCORNER;
93 	(void) __m_acs_cc(br, &wbr);
94 
95 	code = wborder_set(w, &wls, &wrs, &wts, &wbs, &wtl, &wtr, &wbl, &wbr);
96 
97 	return (code);
98 }
99