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