|
|
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 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 COHERENT
19: #ifndef lint
20: static uchar sccsid[] = "@(#)delwin.c 5.3 (Berkeley) 6/30/88";
21: #endif /* not lint */
22: #endif /* not COHERENT */
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.