xref: /csrg-svn/lib/libcurses/box.c (revision 22652)
1*22652Sdist /*
2*22652Sdist  * Copyright (c) 1980 Regents of the University of California.
3*22652Sdist  * All rights reserved.  The Berkeley software License Agreement
4*22652Sdist  * specifies the terms and conditions for redistribution.
5*22652Sdist  */
6*22652Sdist 
7*22652Sdist #ifndef lint
8*22652Sdist static char sccsid[] = "@(#)box.c	5.1 (Berkeley) 06/07/85";
9*22652Sdist #endif not lint
10*22652Sdist 
115862Sarnold # include	"curses.ext"
122237Sarnold 
132237Sarnold /*
142237Sarnold  *	This routine draws a box around the given window with "vert"
152237Sarnold  * as the vertical delimiting char, and "hor", as the horizontal one.
162237Sarnold  *
172237Sarnold  */
182237Sarnold box(win, vert, hor)
192237Sarnold reg WINDOW	*win;
202237Sarnold char		vert, hor; {
212237Sarnold 
222237Sarnold 	reg int		i;
232237Sarnold 	reg int		endy, endx;
242237Sarnold 	reg char	*fp, *lp;
252237Sarnold 
262237Sarnold 	endx = win->_maxx;
272237Sarnold 	endy = win->_maxy - 1;
282237Sarnold 	fp = win->_y[0];
292237Sarnold 	lp = win->_y[endy];
302237Sarnold 	for (i = 0; i < endx; i++)
312237Sarnold 		fp[i] = lp[i] = hor;
322237Sarnold 	endx--;
332237Sarnold 	for (i = 0; i <= endy; i++)
342237Sarnold 		win->_y[i][0] = (win->_y[i][endx] = vert);
352237Sarnold 	if (!win->_scroll && (win->_flags&_SCROLLWIN))
362237Sarnold 		fp[0] = fp[endx] = lp[0] = lp[endx] = ' ';
372237Sarnold 	touchwin(win);
382237Sarnold }
39