diff options
Diffstat (limited to 'lib/libcurses/box.c')
| -rw-r--r-- | lib/libcurses/box.c | 63 |
1 files changed, 37 insertions, 26 deletions
diff --git a/lib/libcurses/box.c b/lib/libcurses/box.c index 983ed66621ca..4f165b330692 100644 --- a/lib/libcurses/box.c +++ b/lib/libcurses/box.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 1981 Regents of the University of California. - * All rights reserved. + * Copyright (c) 1981, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,34 +32,45 @@ */ #ifndef lint -static char sccsid[] = "@(#)box.c 5.4 (Berkeley) 6/1/90"; -#endif /* not lint */ +static char sccsid[] = "@(#)box.c 8.1 (Berkeley) 6/4/93"; +#endif /* not lint */ -# include "curses.ext" +#include <curses.h> /* - * This routine draws a box around the given window with "vert" - * as the vertical delimiting char, and "hor", as the horizontal one. - * + * box -- + * Draw a box around the given window with "vert" as the vertical + * delimiting char, and "hor", as the horizontal one. */ -box(win, vert, hor) -reg WINDOW *win; -char vert, hor; { - - reg int i; - reg int endy, endx; - reg chtype *fp, *lp; +int +box(register WINDOW *win, char vert, char hor) +{ + register int endy, endx, i; + register __LDATA *fp, *lp; - endx = win->_maxx; - endy = win->_maxy - 1; - fp = win->_y[0]; - lp = win->_y[endy]; - for (i = 0; i < endx; i++) - fp[i] = lp[i] = (unsigned char) hor; + endx = win->maxx; + endy = win->maxy - 1; + fp = win->lines[0]->line; + lp = win->lines[endy]->line; + for (i = 0; i < endx; i++) { + fp[i].ch = lp[i].ch = hor; + fp[i].attr &= ~__STANDOUT; + lp[i].attr &= ~__STANDOUT; + } endx--; - for (i = 0; i <= endy; i++) - win->_y[i][0] = (win->_y[i][endx] = (unsigned char) vert); - if (!win->_scroll && (win->_flags&_SCROLLWIN)) - fp[0] = fp[endx] = lp[0] = lp[endx] = ' '; - touchwin(win); + for (i = 0; i <= endy; i++) { + win->lines[i]->line[0].ch = vert; + win->lines[i]->line[endx].ch = vert; + win->lines[i]->line[0].attr &= ~__STANDOUT; + win->lines[i]->line[endx].attr &= ~__STANDOUT; + } + if (!(win->flags & __SCROLLOK) && (win->flags & __SCROLLWIN)) { + fp[0].ch = fp[endx].ch = lp[0].ch = lp[endx].ch = ' '; + fp[0].attr &= ~__STANDOUT; + fp[endx].attr &= ~__STANDOUT; + lp[0].attr &= ~__STANDOUT; + lp[endx].attr &= ~__STANDOUT; + } + __touchwin(win); + return (OK); } |
