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