#ifndef lint
static char
sccsid[] = "@(#)erase.c 1.6 88/02/08 SMI";
#endif
#include <stddef.h>
#include "curses.ext"
int
werase(WINDOW *win)
{
int y;
char *sp, *end, *start, *maxx;
ptrdiff_t minx;
#ifdef DEBUG
fprintf(outf, "WERASE(%0.2o)\n", win);
#endif
for (y = 0; y < win->_maxy; y++) {
minx = _NOCHANGE;
start = win->_y[y];
end = &start[win->_maxx];
for (sp = start; sp < end; sp++)
if (*sp != ' ') {
maxx = sp;
if (minx == _NOCHANGE)
minx = sp - start;
*sp = ' ';
}
if (minx != _NOCHANGE)
(void) touchline(win, y, (int)minx,
(int)(maxx - win->_y[y]));
}
win->_curx = win->_cury = 0;
return (OK);
}