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