8999 SMBIOS: cleanup 32-bit specific code
[unleashed.git] / usr / src / ucblib / libcurses / clrtoeol.c
blob51450a7c44c40727dd03ef24a0d9b148234db212
1 /*
2 * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
6 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
9 /*
10 * Copyright (c) 1980 Regents of the University of California.
11 * All rights reserved. The Berkeley software License Agreement
12 * specifies the terms and conditions for redistribution.
15 #pragma ident "%Z%%M% %I% %E% SMI"
17 /*LINTLIBRARY*/
19 #ifndef lint
20 static char
21 sccsid[] = "@(#)clrtoeol.c 1.6 88/02/08 SMI"; /* from UCB 5.1 85/06/07 */
22 #endif /* not lint */
24 #include <stddef.h>
25 #include "curses.ext"
28 * This routine clears up to the end of line
31 int
32 wclrtoeol(WINDOW *win)
34 char *sp, *end;
35 int y, x;
36 char *maxx;
37 ptrdiff_t minx;
39 y = win->_cury;
40 x = win->_curx;
41 end = &win->_y[y][win->_maxx];
42 minx = _NOCHANGE;
43 maxx = &win->_y[y][x];
44 for (sp = maxx; sp < end; sp++)
45 if (*sp != ' ') {
46 maxx = sp;
47 if (minx == _NOCHANGE)
48 minx = sp - win->_y[y];
49 *sp = ' ';
52 * update firstch and lastch for the line
54 (void) touchline(win, y, win->_curx, win->_maxx - 1);
56 #ifdef DEBUG
57 fprintf(outf, "CLRTOEOL: minx = %d, maxx = %d, firstch = %d,"
58 " lastch = %d\n", minx, maxx - win->_y[y], win->_firstch[y],
59 win->_lastch[y]);
60 #endif
61 return (OK);