122662Sdist /* 234677Sbostic * Copyright (c) 1981 Regents of the University of California. 334677Sbostic * All rights reserved. 434677Sbostic * 542653Sbostic * %sccs.include.redist.c% 622662Sdist */ 722662Sdist 822662Sdist #ifndef lint 9*55957Sbostic static char sccsid[] = "@(#)erase.c 5.5 (Berkeley) 08/23/92"; 10*55957Sbostic #endif /* not lint */ 1122662Sdist 12*55957Sbostic #include <curses.h> 132248Sarnold 142248Sarnold /* 15*55957Sbostic * werase -- 16*55957Sbostic * Erases everything on the window. 172248Sarnold */ 18*55957Sbostic int 192248Sarnold werase(win) 20*55957Sbostic register WINDOW *win; 21*55957Sbostic { 222248Sarnold 23*55957Sbostic register int minx, y; 24*55957Sbostic register char *sp, *end, *start, *maxx; 252248Sarnold 26*55957Sbostic #ifdef DEBUG 27*55957Sbostic __TRACE("werase: (%0.2o)\n", win); 28*55957Sbostic #endif 292248Sarnold for (y = 0; y < win->_maxy; y++) { 302248Sarnold minx = _NOCHANGE; 312248Sarnold start = win->_y[y]; 322248Sarnold end = &start[win->_maxx]; 332248Sarnold for (sp = start; sp < end; sp++) 342248Sarnold if (*sp != ' ') { 352248Sarnold maxx = sp; 362248Sarnold if (minx == _NOCHANGE) 372248Sarnold minx = sp - start; 382248Sarnold *sp = ' '; 392248Sarnold } 4019881Sbloom if (minx != _NOCHANGE) 4119881Sbloom touchline(win, y, minx, maxx - win->_y[y]); 422248Sarnold } 432248Sarnold win->_curx = win->_cury = 0; 44*55957Sbostic return (OK); 452248Sarnold } 46