rework for pmake 2.1
[unix-history] / usr / src / lib / libcurses / box.c
CommitLineData
6e1c93d0 1/*
2f14f200
KB
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
a399f6c8
KB
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6e1c93d0
DF
16 */
17
18#ifndef lint
a399f6c8 19static char sccsid[] = "@(#)box.c 5.3 (Berkeley) %G%";
2f14f200 20#endif /* not lint */
6e1c93d0 21
004a9809 22# include "curses.ext"
4c977e83
KA
23
24/*
25 * This routine draws a box around the given window with "vert"
26 * as the vertical delimiting char, and "hor", as the horizontal one.
27 *
4c977e83
KA
28 */
29box(win, vert, hor)
30reg WINDOW *win;
31char vert, hor; {
32
33 reg int i;
34 reg int endy, endx;
35 reg char *fp, *lp;
36
37 endx = win->_maxx;
38 endy = win->_maxy - 1;
39 fp = win->_y[0];
40 lp = win->_y[endy];
41 for (i = 0; i < endx; i++)
42 fp[i] = lp[i] = hor;
43 endx--;
44 for (i = 0; i <= endy; i++)
45 win->_y[i][0] = (win->_y[i][endx] = vert);
46 if (!win->_scroll && (win->_flags&_SCROLLWIN))
47 fp[0] = fp[endx] = lp[0] = lp[endx] = ' ';
48 touchwin(win);
49}