xref: /csrg-svn/lib/libcurses/box.c (revision 55948)
122652Sdist /*
234677Sbostic  * Copyright (c) 1981 Regents of the University of California.
334677Sbostic  * All rights reserved.
434677Sbostic  *
542651Sbostic  * %sccs.include.redist.c%
622652Sdist  */
722652Sdist 
822652Sdist #ifndef lint
9*55948Sbostic static char sccsid[] = "@(#)box.c	5.5 (Berkeley) 08/23/92";
10*55948Sbostic #endif	/* not lint */
1122652Sdist 
12*55948Sbostic #include <curses.h>
132237Sarnold 
142237Sarnold /*
15*55948Sbostic  * box --
16*55948Sbostic  *	Draw a box around the given window with "vert" as the vertical
17*55948Sbostic  *	delimiting char, and "hor", as the horizontal one.
182237Sarnold  */
19*55948Sbostic int
202237Sarnold box(win, vert, hor)
21*55948Sbostic 	register WINDOW *win;
22*55948Sbostic 	int vert, hor;
23*55948Sbostic {
24*55948Sbostic 	register int endy, endx, i;
25*55948Sbostic 	register char *fp, *lp;
262237Sarnold 
272237Sarnold 	endx = win->_maxx;
282237Sarnold 	endy = win->_maxy - 1;
292237Sarnold 	fp = win->_y[0];
302237Sarnold 	lp = win->_y[endy];
312237Sarnold 	for (i = 0; i < endx; i++)
322237Sarnold 		fp[i] = lp[i] = hor;
332237Sarnold 	endx--;
342237Sarnold 	for (i = 0; i <= endy; i++)
352237Sarnold 		win->_y[i][0] = (win->_y[i][endx] = vert);
36*55948Sbostic 	if (!win->_scroll && (win->_flags & _SCROLLWIN))
372237Sarnold 		fp[0] = fp[endx] = lp[0] = lp[endx] = ' ';
382237Sarnold 	touchwin(win);
39*55948Sbostic 	return (OK);
402237Sarnold }
41