xref: /csrg-svn/lib/libcurses/box.c (revision 42651)
122652Sdist /*
234677Sbostic  * Copyright (c) 1981 Regents of the University of California.
334677Sbostic  * All rights reserved.
434677Sbostic  *
5*42651Sbostic  * %sccs.include.redist.c%
622652Sdist  */
722652Sdist 
822652Sdist #ifndef lint
9*42651Sbostic static char sccsid[] = "@(#)box.c	5.4 (Berkeley) 06/01/90";
1034677Sbostic #endif /* not lint */
1122652Sdist 
125862Sarnold # include	"curses.ext"
132237Sarnold 
142237Sarnold /*
152237Sarnold  *	This routine draws a box around the given window with "vert"
162237Sarnold  * as the vertical delimiting char, and "hor", as the horizontal one.
172237Sarnold  *
182237Sarnold  */
192237Sarnold box(win, vert, hor)
202237Sarnold reg WINDOW	*win;
212237Sarnold char		vert, hor; {
222237Sarnold 
232237Sarnold 	reg int		i;
242237Sarnold 	reg int		endy, endx;
252237Sarnold 	reg 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);
362237Sarnold 	if (!win->_scroll && (win->_flags&_SCROLLWIN))
372237Sarnold 		fp[0] = fp[endx] = lp[0] = lp[endx] = ' ';
382237Sarnold 	touchwin(win);
392237Sarnold }
40