xref: /original-bsd/usr.bin/window/wwclreos.c (revision 99919bf7)
1 /*
2  * Copyright (c) 1983 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  */
17 
18 #ifndef lint
19 static char sccsid[] = "@(#)wwclreos.c	3.8 (Berkeley) 06/29/88";
20 #endif /* not lint */
21 
22 #include "ww.h"
23 #include "tt.h"
24 
25 wwclreos(w, row, col)
26 register struct ww *w;
27 {
28 	register i;
29 	int cleared = 0;
30 
31 	/*
32 	 * Quick and dirty check for windows that cover the bottom
33 	 * portion of the screen.  Not meant to be complete.
34 	 */
35 	if (tt.tt_clreos && w->ww_i.b == wwnrow && w->ww_i.l == 0 &&
36 	    w->ww_i.r == wwncol && wwvisible(w)) {
37 		register j;
38 		register union ww_char *s;
39 
40 		i = row;
41 		(*tt.tt_move)(i, col);
42 		(*tt.tt_clreos)();
43 		/*
44 		 * We have to fix wwos becuase wwclreol1 won't do that.
45 		 */
46 		s = &wwos[i][col];
47 		for (j = wwncol - col; --j >= 0;)
48 			s++->c_w = ' ';
49 		for (i++; i < wwnrow; i++) {
50 			s = wwos[i];
51 			for (j = wwncol; --j >= 0;)
52 				s++->c_w = ' ';
53 		}
54 		cleared = 1;
55 	}
56 	wwclreol1(w, row, col, cleared);
57 	for (i = row + 1; i < w->ww_b.b; i++)
58 		wwclreol1(w, i, w->ww_b.l, cleared);
59 }
60