1 /* 2 * Copyright (c) 1981 Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are permitted 6 * provided that this notice is preserved and that due credit is given 7 * to the University of California at Berkeley. The name of the University 8 * may not be used to endorse or promote products derived from this 9 * software without specific prior written permission. This software 10 * is provided ``as is'' without express or implied warranty. 11 */ 12 13 #ifndef lint 14 static char sccsid[] = "@(#)box.c 5.2 (Berkeley) 06/08/88"; 15 #endif /* not lint */ 16 17 # include "curses.ext" 18 19 /* 20 * This routine draws a box around the given window with "vert" 21 * as the vertical delimiting char, and "hor", as the horizontal one. 22 * 23 */ 24 box(win, vert, hor) 25 reg WINDOW *win; 26 char vert, hor; { 27 28 reg int i; 29 reg int endy, endx; 30 reg char *fp, *lp; 31 32 endx = win->_maxx; 33 endy = win->_maxy - 1; 34 fp = win->_y[0]; 35 lp = win->_y[endy]; 36 for (i = 0; i < endx; i++) 37 fp[i] = lp[i] = hor; 38 endx--; 39 for (i = 0; i <= endy; i++) 40 win->_y[i][0] = (win->_y[i][endx] = vert); 41 if (!win->_scroll && (win->_flags&_SCROLLWIN)) 42 fp[0] = fp[endx] = lp[0] = lp[endx] = ' '; 43 touchwin(win); 44 } 45