document distributed with 4.2BSD
[unix-history] / usr / src / lib / libcurses / box.c
CommitLineData
6e1c93d0
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
7#ifndef lint
8static char sccsid[] = "@(#)box.c 5.1 (Berkeley) %G%";
9#endif not lint
10
004a9809 11# include "curses.ext"
4c977e83
KA
12
13/*
14 * This routine draws a box around the given window with "vert"
15 * as the vertical delimiting char, and "hor", as the horizontal one.
16 *
4c977e83
KA
17 */
18box(win, vert, hor)
19reg WINDOW *win;
20char vert, hor; {
21
22 reg int i;
23 reg int endy, endx;
24 reg char *fp, *lp;
25
26 endx = win->_maxx;
27 endy = win->_maxy - 1;
28 fp = win->_y[0];
29 lp = win->_y[endy];
30 for (i = 0; i < endx; i++)
31 fp[i] = lp[i] = hor;
32 endx--;
33 for (i = 0; i <= endy; i++)
34 win->_y[i][0] = (win->_y[i][endx] = vert);
35 if (!win->_scroll && (win->_flags&_SCROLLWIN))
36 fp[0] = fp[endx] = lp[0] = lp[endx] = ' ';
37 touchwin(win);
38}