make __cputchar visible, the back compatibility stuff uses it
[unix-history] / usr / src / lib / libcurses / box.c
CommitLineData
6e1c93d0 1/*
2f14f200
KB
2 * Copyright (c) 1981 Regents of the University of California.
3 * All rights reserved.
4 *
f1855e9f 5 * %sccs.include.redist.c%
6e1c93d0
DF
6 */
7
8#ifndef lint
79ec5a07 9static char sccsid[] = "@(#)box.c 5.11 (Berkeley) %G%";
cfc1a750 10#endif /* not lint */
6e1c93d0 11
cfc1a750 12#include <curses.h>
4c977e83
KA
13
14/*
cfc1a750
KB
15 * box --
16 * Draw a box around the given window with "vert" as the vertical
17 * delimiting char, and "hor", as the horizontal one.
4c977e83 18 */
cfc1a750 19int
4c977e83 20box(win, vert, hor)
cfc1a750
KB
21 register WINDOW *win;
22 int vert, hor;
23{
24 register int endy, endx, i;
1c04a491 25 register __LDATA *fp, *lp;
4c977e83 26
0c5c5188
EA
27 endx = win->maxx;
28 endy = win->maxy - 1;
1589e7d3 29 fp = win->lines[0]->line;
0c5c5188 30 lp = win->lines[endy]->line;
1589e7d3 31 for (i = 0; i < endx; i++) {
1c04a491
EA
32 fp[i].ch = lp[i].ch = hor;
33 fp[i].attr &= ~__STANDOUT;
34 lp[i].attr &= ~__STANDOUT;
1589e7d3 35 }
4c977e83 36 endx--;
1589e7d3 37 for (i = 0; i <= endy; i++) {
1c04a491
EA
38 win->lines[i]->line[0].ch = vert;
39 win->lines[i]->line[endx].ch = vert;
40 win->lines[i]->line[0].attr &= ~__STANDOUT;
41 win->lines[i]->line[endx].attr &= ~__STANDOUT;
1589e7d3
EA
42 }
43 if (!(win->flags & __SCROLLOK) && (win->flags & __SCROLLWIN)) {
1c04a491
EA
44 fp[0].ch = fp[endx].ch = lp[0].ch = lp[endx].ch = ' ';
45 fp[0].attr &= ~__STANDOUT;
46 fp[endx].attr &= ~__STANDOUT;
47 lp[0].attr &= ~__STANDOUT;
48 lp[endx].attr &= ~__STANDOUT;
1589e7d3 49 }
e3923e32 50 __touchwin(win);
79ec5a07 51 return (OK);
4c977e83 52}