xref: /csrg-svn/lib/libcurses/clrtobot.c (revision 56647)
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*56647Selan static char sccsid[] = "@(#)clrtobot.c	5.9 (Berkeley) 10/26/92";
1055950Sbostic #endif	/* not lint */
1122654Sdist 
1255950Sbostic #include <curses.h>
132240Sarnold 
142240Sarnold /*
1555950Sbostic  * wclrtobot --
1655950Sbostic  *	Erase everything on the window.
172240Sarnold  */
1855950Sbostic int
192240Sarnold wclrtobot(win)
2055950Sbostic 	register WINDOW *win;
2155950Sbostic {
2255950Sbostic 	register int minx, startx, y;
23*56647Selan 	register __LDATA *sp, *end, *maxx;
242240Sarnold 
2556238Selan 	startx = win->curx;
2656238Selan 	for (y = win->cury; y < win->maxy; y++) {
2756238Selan 		minx = -1;
2856238Selan 		end = &win->lines[y]->line[win->maxx];
2956238Selan 		for (sp = &win->lines[y]->line[startx]; sp < end; sp++)
30*56647Selan 			if (sp->ch != ' ' || sp->attr != 0) {
312240Sarnold 				maxx = sp;
3256238Selan 				if (minx == -1)
3356238Selan 					minx = sp - win->lines[y]->line;
34*56647Selan 				sp->ch = ' ';
35*56647Selan 				sp->attr = 0;
362240Sarnold 			}
3756238Selan 		if (minx != -1)
38*56647Selan 			touchline(win, y, minx, maxx - win->lines[y]->line);
392240Sarnold 		startx = 0;
402240Sarnold 	}
4155950Sbostic 	return (OK);
422240Sarnold }
43