1 # include "curses.ext" 2 3 /* 4 * This routine clears up to the end of line 5 * 6 * 03/05/81 (Berkeley) @(#)clrtoeol.c 1.2 7 */ 8 wclrtoeol(win) 9 reg WINDOW *win; { 10 11 reg char *sp, *end; 12 reg int y, x; 13 reg char *maxx; 14 reg int minx; 15 16 y = win->_cury; 17 x = win->_curx; 18 end = &win->_y[y][win->_maxx]; 19 minx = _NOCHANGE; 20 maxx = &win->_y[y][x]; 21 for (sp = maxx; sp < end; sp++) 22 if (*sp != ' ') { 23 maxx = sp; 24 if (minx == _NOCHANGE) 25 minx = sp - win->_y[y]; 26 *sp = ' '; 27 } 28 /* 29 * update firstch and lastch for the line 30 */ 31 # ifdef DEBUG 32 fprintf(outf, "CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", minx, maxx - win->_y[y], win->_firstch[y], win->_lastch[y]); 33 # endif 34 if (minx != _NOCHANGE) { 35 if (win->_firstch[y] > minx || win->_firstch[y] == _NOCHANGE) 36 win->_firstch[y] = minx; 37 if (win->_lastch[y] < maxx - win->_y[y]) 38 win->_lastch[y] = maxx - win->_y[y]; 39 } 40 } 41