restore terminal state correctly; bug report 4.3BSD-tahoe/include/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 *
f1855e9f 5 * %sccs.include.redist.c%
6e1c93d0
DF
6 */
7
8#ifndef lint
f1855e9f 9static char sccsid[] = "@(#)box.c 5.4 (Berkeley) %G%";
2f14f200 10#endif /* not lint */
6e1c93d0 11
004a9809 12# include "curses.ext"
4c977e83
KA
13
14/*
15 * This routine draws a box around the given window with "vert"
16 * as the vertical delimiting char, and "hor", as the horizontal one.
17 *
4c977e83
KA
18 */
19box(win, vert, hor)
20reg WINDOW *win;
21char vert, hor; {
22
23 reg int i;
24 reg int endy, endx;
25 reg char *fp, *lp;
26
27 endx = win->_maxx;
28 endy = win->_maxy - 1;
29 fp = win->_y[0];
30 lp = win->_y[endy];
31 for (i = 0; i < endx; i++)
32 fp[i] = lp[i] = hor;
33 endx--;
34 for (i = 0; i <= endy; i++)
35 win->_y[i][0] = (win->_y[i][endx] = vert);
36 if (!win->_scroll && (win->_flags&_SCROLLWIN))
37 fp[0] = fp[endx] = lp[0] = lp[endx] = ' ';
38 touchwin(win);
39}