1 /* 2 * Copyright (c) 1980 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 */ 6 7 #ifndef lint 8 static char sccsid[] = "@(#)clrtoeol.c 5.1 (Berkeley) 06/07/85"; 9 #endif not lint 10 11 # include "curses.ext" 12 13 /* 14 * This routine clears up to the end of line 15 * 16 */ 17 wclrtoeol(win) 18 reg WINDOW *win; { 19 20 reg char *sp, *end; 21 reg int y, x; 22 reg char *maxx; 23 reg int minx; 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 /* 38 * update firstch and lastch for the line 39 */ 40 touchline(win, y, win->_curx, win->_maxx - 1); 41 # ifdef DEBUG 42 fprintf(outf, "CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", minx, maxx - win->_y[y], win->_firstch[y], win->_lastch[y]); 43 # endif 44 } 45