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