xref: /original-bsd/usr.bin/window/wwclose.c (revision 93bede30)
1 /*
2  * Copyright (c) 1983, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Edward Wang at The University of California, Berkeley.
7  *
8  * %sccs.include.redist.c%
9  */
10 
11 #ifndef lint
12 static char sccsid[] = "@(#)wwclose.c	8.1 (Berkeley) 06/06/93";
13 #endif /* not lint */
14 
15 #include "ww.h"
16 
17 wwclose(w)
18 register struct ww *w;
19 {
20 	wwindex[w->ww_index] = 0;
21 	if (w->ww_pty >= 0)
22 		(void) close(w->ww_pty);
23 	if (w->ww_socket >= 0)
24 		(void) close(w->ww_socket);
25 	wwfree((char **)w->ww_win, w->ww_w.t);
26 	wwfree((char **)w->ww_buf, w->ww_b.t);
27 	if (w->ww_fmap != 0)
28 		wwfree((char **)w->ww_fmap, w->ww_w.t);
29 	free((char *)(w->ww_nvis + w->ww_w.t));
30 	if (w->ww_ob != 0)
31 		free(w->ww_ob);
32 	free((char *)w);
33 }
34