1*10224Smckusick /* Copyright (c) 1982 Regents of the University of California */
2*10224Smckusick 
3*10224Smckusick static	char sccsid[] = "@(#)DFDISPOSE.c	4.1	(Berkeley)	01/10/83";
4*10224Smckusick 
5*10224Smckusick /*
6*10224Smckusick  * Close all active files within a dynamic record,
7*10224Smckusick  * then dispose of the record.
8*10224Smckusick  */
9*10224Smckusick 
10*10224Smckusick #include "h00vars.h"
11*10224Smckusick #include "libpc.h"
12*10224Smckusick 
13*10224Smckusick DFDISPOSE(var, size)
14*10224Smckusick 	char	**var;	/* pointer to pointer being deallocated */
15*10224Smckusick 	long	size;	/* sizeof(bletch) */
16*10224Smckusick {
17*10224Smckusick 	register struct iorec	*next, *prev;
18*10224Smckusick 	struct iorec *start, *end;
19*10224Smckusick 
20*10224Smckusick 	start = (struct iorec *)(*var);
21*10224Smckusick 	end = (struct iorec *)(*var + size);
22*10224Smckusick 	prev = (struct iorec *)(&_fchain);
23*10224Smckusick 	next = _fchain.fchain;
24*10224Smckusick 	while(next != FILNIL && (next->flev < GLVL || next < start)) {
25*10224Smckusick 		prev = next;
26*10224Smckusick 		next = next->fchain;
27*10224Smckusick 	}
28*10224Smckusick 	while(next != FILNIL && next < end)
29*10224Smckusick 		next = PFCLOSE(next);
30*10224Smckusick 	prev->fchain = next;
31*10224Smckusick 	DISPOSE(var, size);
32*10224Smckusick }
33