1*40865Sbostic /*-
2*40865Sbostic  * Copyright (c) 1982 The Regents of the University of California.
3*40865Sbostic  * All rights reserved.
4*40865Sbostic  *
5*40865Sbostic  * %sccs.include.redist.c%
6*40865Sbostic  */
710224Smckusick 
8*40865Sbostic #ifndef lint
9*40865Sbostic static char sccsid[] = "@(#)DFDISPOSE.c	4.4 (Berkeley) 04/09/90";
10*40865Sbostic #endif /* not lint */
1110224Smckusick 
1210224Smckusick /*
1310224Smckusick  * Close all active files within a dynamic record,
1410224Smckusick  * then dispose of the record.
1510224Smckusick  */
1610224Smckusick 
1710224Smckusick #include "h00vars.h"
1810224Smckusick #include "libpc.h"
1910224Smckusick 
2010224Smckusick DFDISPOSE(var, size)
2110224Smckusick 	char	**var;	/* pointer to pointer being deallocated */
2210224Smckusick 	long	size;	/* sizeof(bletch) */
2310224Smckusick {
2410224Smckusick 	register struct iorec	*next, *prev;
2510224Smckusick 	struct iorec *start, *end;
2610224Smckusick 
2710224Smckusick 	start = (struct iorec *)(*var);
2810224Smckusick 	end = (struct iorec *)(*var + size);
2910224Smckusick 	prev = (struct iorec *)(&_fchain);
3010224Smckusick 	next = _fchain.fchain;
3110224Smckusick 	while(next != FILNIL && (next->flev < GLVL || next < start)) {
3210224Smckusick 		prev = next;
3310224Smckusick 		next = next->fchain;
3410224Smckusick 	}
3529547Smckusick 	while(next != FILNIL && start <= next && next < end)
3610565Smckusick 		next = PFCLOSE(next, TRUE);
3710224Smckusick 	prev->fchain = next;
3810224Smckusick 	DISPOSE(var, size);
3910224Smckusick }
40