110224Smckusick /* Copyright (c) 1982 Regents of the University of California */
210224Smckusick 
3*29547Smckusick static	char sccsid[] = "@(#)DFDISPOSE.c	4.3	(Berkeley)	07/07/86";
410224Smckusick 
510224Smckusick /*
610224Smckusick  * Close all active files within a dynamic record,
710224Smckusick  * then dispose of the record.
810224Smckusick  */
910224Smckusick 
1010224Smckusick #include "h00vars.h"
1110224Smckusick #include "libpc.h"
1210224Smckusick 
1310224Smckusick DFDISPOSE(var, size)
1410224Smckusick 	char	**var;	/* pointer to pointer being deallocated */
1510224Smckusick 	long	size;	/* sizeof(bletch) */
1610224Smckusick {
1710224Smckusick 	register struct iorec	*next, *prev;
1810224Smckusick 	struct iorec *start, *end;
1910224Smckusick 
2010224Smckusick 	start = (struct iorec *)(*var);
2110224Smckusick 	end = (struct iorec *)(*var + size);
2210224Smckusick 	prev = (struct iorec *)(&_fchain);
2310224Smckusick 	next = _fchain.fchain;
2410224Smckusick 	while(next != FILNIL && (next->flev < GLVL || next < start)) {
2510224Smckusick 		prev = next;
2610224Smckusick 		next = next->fchain;
2710224Smckusick 	}
28*29547Smckusick 	while(next != FILNIL && start <= next && next < end)
2910565Smckusick 		next = PFCLOSE(next, TRUE);
3010224Smckusick 	prev->fchain = next;
3110224Smckusick 	DISPOSE(var, size);
3210224Smckusick }
33