xref: /csrg-svn/lib/libcurses/clrtobot.c (revision 55950)
122654Sdist /*
234677Sbostic  * Copyright (c) 1981 Regents of the University of California.
334677Sbostic  * All rights reserved.
434677Sbostic  *
542653Sbostic  * %sccs.include.redist.c%
622654Sdist  */
722654Sdist 
822654Sdist #ifndef lint
9*55950Sbostic static char sccsid[] = "@(#)clrtobot.c	5.6 (Berkeley) 08/23/92";
10*55950Sbostic #endif	/* not lint */
1122654Sdist 
12*55950Sbostic #include <curses.h>
132240Sarnold 
142240Sarnold /*
15*55950Sbostic  * wclrtobot --
16*55950Sbostic  *	Erase everything on the window.
172240Sarnold  */
18*55950Sbostic int
192240Sarnold wclrtobot(win)
20*55950Sbostic 	register WINDOW *win;
21*55950Sbostic {
22*55950Sbostic 	register int minx, startx, y;
23*55950Sbostic 	register char *sp, *end, *maxx;
242240Sarnold 
252240Sarnold 	startx = win->_curx;
262240Sarnold 	for (y = win->_cury; y < win->_maxy; y++) {
272240Sarnold 		minx = _NOCHANGE;
282240Sarnold 		end = &win->_y[y][win->_maxx];
292240Sarnold 		for (sp = &win->_y[y][startx]; sp < end; sp++)
302240Sarnold 			if (*sp != ' ') {
312240Sarnold 				maxx = sp;
322240Sarnold 				if (minx == _NOCHANGE)
332240Sarnold 					minx = sp - win->_y[y];
342240Sarnold 				*sp = ' ';
352240Sarnold 			}
3619872Sbloom 		if (minx != _NOCHANGE)
3725281Sbloom 			touchline(win, y, minx, maxx - &win->_y[y][0]);
382240Sarnold 		startx = 0;
392240Sarnold 	}
40*55950Sbostic 	return (OK);
412240Sarnold }
42