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.12 (Berkeley) 05/16/93"; 10 #endif /* not lint */ 11 12 #include <curses.h> 13 14 /* 15 * werase -- 16 * Erases everything on the window. 17 */ 18 int 19 werase(win) 20 register WINDOW *win; 21 { 22 23 register int minx, y; 24 register __LDATA *sp, *end, *start, *maxx; 25 26 #ifdef DEBUG 27 __CTRACE("werase: (%0.2o)\n", win); 28 #endif 29 for (y = 0; y < win->maxy; y++) { 30 minx = -1; 31 start = win->lines[y]->line; 32 end = &start[win->maxx]; 33 for (sp = start; sp < end; sp++) 34 if (sp->ch != ' ' || sp->attr != 0) { 35 maxx = sp; 36 if (minx == -1) 37 minx = sp - start; 38 sp->ch = ' '; 39 sp->attr = 0; 40 } 41 if (minx != -1) 42 __touchline(win, y, minx, maxx - win->lines[y]->line, 43 0); 44 } 45 return (OK); 46 } 47