xref: /csrg-svn/lib/libcurses/clrtobot.c (revision 56238)
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*56238Selan static char sccsid[] = "@(#)clrtobot.c	5.7 (Berkeley) 09/14/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;
2355950Sbostic 	register char *sp, *end, *maxx;
242240Sarnold 
25*56238Selan 	startx = win->curx;
26*56238Selan 	for (y = win->cury; y < win->maxy; y++) {
27*56238Selan 		minx = -1;
28*56238Selan 		end = &win->lines[y]->line[win->maxx];
29*56238Selan 		for (sp = &win->lines[y]->line[startx]; sp < end; sp++)
302240Sarnold 			if (*sp != ' ') {
312240Sarnold 				maxx = sp;
32*56238Selan 				if (minx == -1)
33*56238Selan 					minx = sp - win->lines[y]->line;
342240Sarnold 				*sp = ' ';
352240Sarnold 			}
36*56238Selan 		if (minx != -1)
37*56238Selan 			touchline(win, y, minx,
38*56238Selan 			    maxx - win->lines[y]->line);
392240Sarnold 		startx = 0;
402240Sarnold 	}
4155950Sbostic 	return (OK);
422240Sarnold }
43