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.6 (Berkeley) 09/14/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->lines[y]->line[win->maxx]; 28 minx = -1; 29 maxx = &win->lines[y]->line[x]; 30 for (sp = maxx; sp < end; sp++) 31 if (*sp != ' ') { 32 maxx = sp; 33 if (minx == -1) 34 minx = sp - win->lines[y]->line; 35 *sp = ' '; 36 } 37 #ifdef DEBUG 38 __TRACE("CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", 39 minx, maxx - win->lines[y]->line, win->lines[y]->firstch, 40 win->lines[y]->lastch); 41 #endif 42 /* Update firstch and lastch for the line. */ 43 return (touchline(win, y, win->curx, win->maxx - 1)); 44 } 45