1: # include "curses.ext" 2: 3: /* 4: * This routine erases everything on the window. 5: * 6: * 1/26/81 (Berkeley) @(#)clrtobot.c 1.1 7: */ 8: wclrtobot(win) 9: reg WINDOW *win; { 10: 11: reg int y; 12: reg char *sp, *end, *maxx; 13: reg int startx, minx; 14: 15: startx = win->_curx; 16: for (y = win->_cury; y < win->_maxy; y++) { 17: minx = _NOCHANGE; 18: end = &win->_y[y][win->_maxx]; 19: for (sp = &win->_y[y][startx]; sp < end; sp++) 20: if (*sp != ' ') { 21: maxx = sp; 22: if (minx == _NOCHANGE) 23: minx = sp - win->_y[y]; 24: *sp = ' '; 25: } 26: if (minx != _NOCHANGE) { 27: if (win->_firstch[y] > minx 28: || win->_firstch[y] == _NOCHANGE) 29: win->_firstch[y] = minx; 30: if (win->_lastch[y] < maxx - win->_y[y]) 31: win->_lastch[y] = maxx - win->_y[y]; 32: } 33: startx = 0; 34: } 35: win->_curx = win->_cury = 0; 36: }