1: # include "curses.ext"
2:
3: /*
4: * This routine erases everything on the window.
5: *
6: * 1/27/81 (Berkeley) @(#)erase.c 1.2
7: */
8: werase(win)
9: reg WINDOW *win; {
10:
11: reg int y;
12: reg char *sp, *end, *start, *maxx;
13: reg int minx;
14:
15: # ifdef DEBUG
16: fprintf(outf, "WERASE(%0.2o)\n", win);
17: # endif
18: for (y = 0; y < win->_maxy; y++) {
19: minx = _NOCHANGE;
20: start = win->_y[y];
21: end = &start[win->_maxx];
22: for (sp = start; sp < end; sp++)
23: if (*sp != ' ') {
24: maxx = sp;
25: if (minx == _NOCHANGE)
26: minx = sp - start;
27: *sp = ' ';
28: }
29: if (minx != _NOCHANGE) {
30: if (win->_firstch[y] > minx
31: || win->_firstch[y] == _NOCHANGE)
32: win->_firstch[y] = minx;
33: if (win->_lastch[y] < maxx - win->_y[y])
34: win->_lastch[y] = maxx - win->_y[y];
35: }
36: }
37: win->_curx = win->_cury = 0;
38: }
Defined functions
werase
defined in line
8; used 5 times