xref: /illumos-gate/usr/src/lib/libxcurses/src/libc/xcurses/wbrdr.c (revision 20a7641f9918de8574b8b3b47dbe35c4bfc78df1)
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 /*
28  * wbrdr.c
29  *
30  * XCurses Library
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/wbrdr.c 1.2 1995/07/07 18:53:03 ant Exp $";
39 #endif
40 #endif
41 
42 #include <private.h>
43 
44 /*f
45  * Draw a border around the edges of the window. The parms correspond to
46  * a character and attribute for the left, right, top, and bottom sides,
47  * top left, top right, bottom left, and bottom right corners. A zero in
48  * any character parm means to take the default.
49  */
50 int
51 wborder(WINDOW *w,
52 	chtype ls, chtype rs, chtype ts, chtype bs,
53 	chtype tl, chtype tr, chtype bl, chtype br)
54 {
55 	int code;
56 	cchar_t wls, wrs, wts, wbs, wtl, wtr, wbl, wbr;
57 
58 #ifdef M_CURSES_TRACE
59 	__m_trace(
60 		"wborder(%p, %ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld)",
61 		 w, ls, rs, ts, bs, tl, tr, bl, br
62 	);
63 #endif
64 
65 	if (ls == 0)
66 		ls = ACS_VLINE;
67 	(void) __m_acs_cc(ls, &wls);
68 
69 	if (rs == 0)
70 		rs = ACS_VLINE;
71 	(void) __m_acs_cc(rs, &wrs);
72 
73 	if (ts == 0)
74 		ts = ACS_HLINE;
75 	(void) __m_acs_cc(ts, &wts);
76 
77 	if (bs == 0)
78 		bs = ACS_HLINE;
79 	(void) __m_acs_cc(bs, &wbs);
80 
81 	if (tl == 0)
82 		tl = ACS_ULCORNER;
83 	(void) __m_acs_cc(tl, &wtl);
84 
85 	if (tr == 0)
86 		tr = ACS_URCORNER;
87 	(void) __m_acs_cc(tr, &wtr);
88 
89 	if (bl == 0)
90 		bl = ACS_LLCORNER;
91 	(void) __m_acs_cc(bl, &wbl);
92 
93 	if (br == 0)
94 		br = ACS_LRCORNER;
95 	(void) __m_acs_cc(br, &wbr);
96 
97 	code = wborder_set(w, &wls, &wrs, &wts, &wbs, &wtl, &wtr, &wbl, &wbr);
98 
99 	return __m_return_code("wborder", code);
100 }
101 
102