xref: /original-bsd/lib/libcurses/clrtobot.c (revision 860e07fc)
1 /*
2  * Copyright (c) 1981 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)clrtobot.c	5.6 (Berkeley) 08/23/92";
10 #endif	/* not lint */
11 
12 #include <curses.h>
13 
14 /*
15  * wclrtobot --
16  *	Erase everything on the window.
17  */
18 int
19 wclrtobot(win)
20 	register WINDOW *win;
21 {
22 	register int minx, startx, y;
23 	register char *sp, *end, *maxx;
24 
25 	startx = win->_curx;
26 	for (y = win->_cury; y < win->_maxy; y++) {
27 		minx = _NOCHANGE;
28 		end = &win->_y[y][win->_maxx];
29 		for (sp = &win->_y[y][startx]; sp < end; sp++)
30 			if (*sp != ' ') {
31 				maxx = sp;
32 				if (minx == _NOCHANGE)
33 					minx = sp - win->_y[y];
34 				*sp = ' ';
35 			}
36 		if (minx != _NOCHANGE)
37 			touchline(win, y, minx, maxx - &win->_y[y][0]);
38 		startx = 0;
39 	}
40 	return (OK);
41 }
42