122662Sdist /* 2*34677Sbostic * Copyright (c) 1981 Regents of the University of California. 3*34677Sbostic * All rights reserved. 4*34677Sbostic * 5*34677Sbostic * Redistribution and use in source and binary forms are permitted 6*34677Sbostic * provided that this notice is preserved and that due credit is given 7*34677Sbostic * to the University of California at Berkeley. The name of the University 8*34677Sbostic * may not be used to endorse or promote products derived from this 9*34677Sbostic * software without specific prior written permission. This software 10*34677Sbostic * is provided ``as is'' without express or implied warranty. 1122662Sdist */ 1222662Sdist 1322662Sdist #ifndef lint 14*34677Sbostic static char sccsid[] = "@(#)erase.c 5.2 (Berkeley) 06/08/88"; 15*34677Sbostic #endif /* not lint */ 1622662Sdist 172248Sarnold # include "curses.ext" 182248Sarnold 192248Sarnold /* 202248Sarnold * This routine erases everything on the window. 212248Sarnold * 222248Sarnold */ 232248Sarnold werase(win) 242248Sarnold reg WINDOW *win; { 252248Sarnold 262248Sarnold reg int y; 272248Sarnold reg char *sp, *end, *start, *maxx; 282248Sarnold reg int minx; 292248Sarnold 302288Sarnold # ifdef DEBUG 312288Sarnold fprintf(outf, "WERASE(%0.2o)\n", win); 322288Sarnold # endif 332248Sarnold for (y = 0; y < win->_maxy; y++) { 342248Sarnold minx = _NOCHANGE; 352248Sarnold start = win->_y[y]; 362248Sarnold end = &start[win->_maxx]; 372248Sarnold for (sp = start; sp < end; sp++) 382248Sarnold if (*sp != ' ') { 392248Sarnold maxx = sp; 402248Sarnold if (minx == _NOCHANGE) 412248Sarnold minx = sp - start; 422248Sarnold *sp = ' '; 432248Sarnold } 4419881Sbloom if (minx != _NOCHANGE) 4519881Sbloom touchline(win, y, minx, maxx - win->_y[y]); 462248Sarnold } 472248Sarnold win->_curx = win->_cury = 0; 482248Sarnold } 49