1 /* 2 * Copyright (c) 1981 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)erase.c 5.4 (Berkeley) 06/01/90"; 10 #endif /* not lint */ 11 12 # include "curses.ext" 13 14 /* 15 * This routine erases everything on the window. 16 * 17 */ 18 werase(win) 19 reg WINDOW *win; { 20 21 reg int y; 22 reg char *sp, *end, *start, *maxx; 23 reg int minx; 24 25 # ifdef DEBUG 26 fprintf(outf, "WERASE(%0.2o)\n", win); 27 # endif 28 for (y = 0; y < win->_maxy; y++) { 29 minx = _NOCHANGE; 30 start = win->_y[y]; 31 end = &start[win->_maxx]; 32 for (sp = start; sp < end; sp++) 33 if (*sp != ' ') { 34 maxx = sp; 35 if (minx == _NOCHANGE) 36 minx = sp - start; 37 *sp = ' '; 38 } 39 if (minx != _NOCHANGE) 40 touchline(win, y, minx, maxx - win->_y[y]); 41 } 42 win->_curx = win->_cury = 0; 43 } 44