xref: /csrg-svn/usr.bin/window/wwclose.c (revision 33514)
118735Sedward /*
2*33514Sbostic  * Copyright (c) 1983 Regents of the University of California.
3*33514Sbostic  * All rights reserved.
4*33514Sbostic  *
5*33514Sbostic  * Redistribution and use in source and binary forms are permitted
6*33514Sbostic  * provided that this notice is preserved and that due credit is given
7*33514Sbostic  * to the University of California at Berkeley. The name of the University
8*33514Sbostic  * may not be used to endorse or promote products derived from this
9*33514Sbostic  * software without specific prior written permission. This software
10*33514Sbostic  * is provided ``as is'' without express or implied warranty.
1118735Sedward  */
1218735Sedward 
13*33514Sbostic #ifndef lint
14*33514Sbostic static char sccsid[] = "@(#)wwclose.c	3.14 (Berkeley) 02/21/88";
15*33514Sbostic #endif /* not lint */
16*33514Sbostic 
1713982Sedward #include "ww.h"
1813982Sedward #include <signal.h>
1913982Sedward 
2013982Sedward wwclose(w)
2113982Sedward register struct ww *w;
2213982Sedward {
2314415Sedward 	wwindex[w->ww_index] = 0;
2416313Sedward 	if (w->ww_pty >= 0)
2516313Sedward 		(void) close(w->ww_pty);
2616313Sedward 	if (w->ww_socket >= 0)
2716313Sedward 		(void) close(w->ww_socket);
2814987Sedward 	wwfree((char **)w->ww_win, w->ww_w.t);
2918203Sedward 	wwfree((char **)w->ww_buf, w->ww_b.t);
3014830Sedward 	if (w->ww_fmap != 0)
3114987Sedward 		wwfree((char **)w->ww_fmap, w->ww_w.t);
3214987Sedward 	free((char *)(w->ww_nvis + w->ww_w.t));
3316108Sedward 	if (w->ww_ob != 0)
3416108Sedward 		free(w->ww_ob);
3514415Sedward 	free((char *)w);
3613982Sedward }
37