. use library function to parse memory string
[minix3.git] / lib / curses / wclrtoeol.c
blobea72976a8accf53d9480d3bedfc396a4766a2929
1 #include <curses.h>
2 #include "curspriv.h"
4 /****************************************************************/
5 /* Wclrtoeol() fills the half of the cursor line to the right */
6 /* Of the cursor in window 'win' with blanks. */
7 /****************************************************************/
9 int wclrtoeol(win)
10 WINDOW *win;
12 int *maxx, *ptr, *end, y, x, minx, blank;
14 y = win->_cury;
15 x = win->_curx;
16 blank = ' ' | (win->_attrs & ATR_MSK);
18 end = &win->_line[y][win->_maxx];
19 minx = _NO_CHANGE;
20 maxx = &win->_line[y][x];
21 for (ptr = maxx; ptr <= end; ptr++) {
22 if (*ptr != blank) {
23 maxx = ptr;
24 if (minx == _NO_CHANGE) minx = ptr - win->_line[y];
25 *ptr = blank;
26 } /* if */
27 } /* for */
29 if (minx != _NO_CHANGE) {
30 if (win->_minchng[y] > minx || win->_minchng[y] == _NO_CHANGE)
31 win->_minchng[y] = minx;
32 if (win->_maxchng[y] < maxx - win->_line[y])
33 win->_maxchng[y] = maxx - win->_line[y];
35 return(OK);