xref: /csrg-svn/usr.bin/pascal/libpc/UNIT.c (revision 62096)
140865Sbostic /*-
2*62096Sbostic  * Copyright (c) 1979, 1993
3*62096Sbostic  *	The Regents of the University of California.  All rights reserved.
440865Sbostic  *
540865Sbostic  * %sccs.include.redist.c%
640865Sbostic  */
71712Smckusick 
840865Sbostic #ifndef lint
9*62096Sbostic static char sccsid[] = "@(#)UNIT.c	8.1 (Berkeley) 06/06/93";
1040865Sbostic #endif /* not lint */
111712Smckusick 
121712Smckusick #include "h00vars.h"
131712Smckusick 
141712Smckusick struct iorec *
UNIT(curfile)151712Smckusick UNIT(curfile)
161712Smckusick 
171712Smckusick 	register struct iorec	*curfile;
181712Smckusick {
191712Smckusick 	if (curfile->fblk >= MAXFILES || _actfile[curfile->fblk] != curfile) {
203869Smckusic 		ERROR("Reference to an inactive file\n", 0);
211712Smckusick 		return;
221712Smckusick 	}
231712Smckusick 	if (curfile->funit & FDEF) {
243869Smckusic 		ERROR("%s: Reference to an inactive file\n", curfile->pfname);
251712Smckusick 		return;
261712Smckusick 	}
271712Smckusick 	return curfile;
281712Smckusick }
29