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.6 (Berkeley) 09/14/92"; 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 char *sp, *end, *start, *maxx; 25 26 #ifdef DEBUG 27 __TRACE("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 != ' ') { 35 maxx = sp; 36 if (minx == -1) 37 minx = sp - start; 38 *sp = ' '; 39 } 40 if (minx != -1) 41 touchline(win, y, minx, maxx - win->lines[y]->line); 42 } 43 win->curx = win->cury = 0; 44 return (OK); 45 } 46