xref: /original-bsd/lib/libcurses/clrtobot.c (revision b424313c)
1 /*
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
6  * provided that this notice is preserved and that due credit is given
7  * to the University of California at Berkeley. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  */
12 
13 #ifndef lint
14 static char sccsid[] = "@(#)clrtobot.c	5.3 (Berkeley) 06/08/88";
15 #endif /* not lint */
16 
17 # include	"curses.ext"
18 
19 /*
20  *	This routine erases everything on the window.
21  *
22  */
23 wclrtobot(win)
24 reg WINDOW	*win; {
25 
26 	reg int		y;
27 	reg char	*sp, *end, *maxx;
28 	reg int		startx, minx;
29 
30 	startx = win->_curx;
31 	for (y = win->_cury; y < win->_maxy; y++) {
32 		minx = _NOCHANGE;
33 		end = &win->_y[y][win->_maxx];
34 		for (sp = &win->_y[y][startx]; sp < end; sp++)
35 			if (*sp != ' ') {
36 				maxx = sp;
37 				if (minx == _NOCHANGE)
38 					minx = sp - win->_y[y];
39 				*sp = ' ';
40 			}
41 		if (minx != _NOCHANGE)
42 			touchline(win, y, minx, maxx - &win->_y[y][0]);
43 		startx = 0;
44 	}
45 }
46