manual page distributed with 4.1BSD
[unix-history] / usr / src / lib / libcurses / clrtoeol.c
CommitLineData
e6f2eb0e
KA
1# include "curses.ext"
2
3/*
4 * This routine clears up to the end of line
5 *
26a29dea 6 * @(#)clrtoeol.c 1.3 (Berkeley) %G%
e6f2eb0e
KA
7 */
8wclrtoeol(win)
9reg WINDOW *win; {
10
11 reg char *sp, *end;
12 reg int y, x;
13 reg char *maxx;
14 reg int minx;
15
16 y = win->_cury;
17 x = win->_curx;
18 end = &win->_y[y][win->_maxx];
19 minx = _NOCHANGE;
20 maxx = &win->_y[y][x];
21 for (sp = maxx; sp < end; sp++)
22 if (*sp != ' ') {
23 maxx = sp;
24 if (minx == _NOCHANGE)
25 minx = sp - win->_y[y];
26 *sp = ' ';
27 }
28 /*
29 * update firstch and lastch for the line
30 */
26a29dea 31 touchline(win, y, win->_curx, win->_maxx - 1);
e6f2eb0e
KA
32# ifdef DEBUG
33 fprintf(outf, "CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", minx, maxx - win->_y[y], win->_firstch[y], win->_lastch[y]);
34# endif
e6f2eb0e 35}