|
|
1.1 root 1: /*
2: * Copyright (c) 1981 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: (1) source distributions retain this entire copyright
7: * notice and comment, and (2) distributions including binaries display
8: * the following acknowledgement: ``This product includes software
9: * developed by the University of California, Berkeley and its contributors''
10: * in the documentation or other materials provided with the distribution
11: * and in all advertising materials mentioning features or use of this
12: * software. Neither the name of the University nor the names of its
13: * contributors may be used to endorse or promote products derived
14: * from this software without specific prior written permission.
15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18: */
19:
20: #ifndef lint
21: static char sccsid[] = "@(#)delwin.c 5.4 (Berkeley) 6/1/90";
22: #endif /* not lint */
23:
24: # include "curses.ext"
25:
26: /*
27: * This routine deletes a window and releases it back to the system.
28: *
29: */
30: delwin(win)
31: reg WINDOW *win; {
32:
33: reg int i;
34: reg WINDOW *wp, *np;
35:
36: if (win->_orig == NULL) {
37: /*
38: * If we are the original window, delete the space for
39: * all the subwindows, and the array of space as well.
40: */
41: for (i = 0; i < win->_maxy && win->_y[i]; i++)
42: free(win->_y[i]);
43: free(win->_firstch);
44: free(win->_lastch);
45: wp = win->_nextp;
46: while (wp != win) {
47: np = wp->_nextp;
48: delwin(wp);
49: wp = np;
50: }
51: }
52: else {
53: /*
54: * If we are a subwindow, take ourselves out of the
55: * list. NOTE: if we are a subwindow, the minimum list
56: * is orig followed by this subwindow, so there are
57: * always at least two windows in the list.
58: */
59: for (wp = win->_nextp; wp->_nextp != win; wp = wp->_nextp)
60: continue;
61: wp->_nextp = win->_nextp;
62: }
63: free(win->_y);
64: free(win);
65: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.