1 /* 2 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 3 * Use is subject to license terms. 4 */ 5 6 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 7 /* All Rights Reserved */ 8 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. 13 */ 14 15 /*LINTLIBRARY*/ 16 17 #ifndef lint 18 static char 19 sccsid[] = "@(#)clrtobot.c 1.7 88/02/08 SMI"; /* from UCB 5.2 85/10/24 */ 20 #endif /* not lint */ 21 22 #include <stddef.h> 23 #include "curses.ext" 24 25 /* 26 * This routine erases everything on the window. 27 */ 28 29 int 30 wclrtobot(WINDOW *win) 31 { 32 int y; 33 char *sp, *end, *maxx; 34 int startx; 35 ptrdiff_t minx; 36 37 startx = win->_curx; 38 for (y = win->_cury; y < win->_maxy; y++) { 39 minx = _NOCHANGE; 40 end = &win->_y[y][win->_maxx]; 41 for (sp = &win->_y[y][startx]; sp < end; sp++) 42 if (*sp != ' ') { 43 maxx = sp; 44 if (minx == _NOCHANGE) 45 minx = sp - win->_y[y]; 46 *sp = ' '; 47 } 48 if (minx != _NOCHANGE) 49 (void) touchline(win, y, (int)minx, 50 (int)(maxx - &win->_y[y][0])); 51 startx = 0; 52 } 53 return (OK); 54 } 55