xref: /original-bsd/lib/libcurses/clrtobot.c (revision e59fb703)
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.5 (Berkeley) 06/01/90";
10 #endif /* not lint */
11 
12 # include	"curses.ext"
13 
14 /*
15  *	This routine erases everything on the window.
16  *
17  */
18 wclrtobot(win)
19 reg WINDOW	*win; {
20 
21 	reg int		y;
22 	reg char	*sp, *end, *maxx;
23 	reg int		startx, minx;
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 }
41