xref: /csrg-svn/usr.bin/pascal/libpc/UNIT.c (revision 40865)
1*40865Sbostic /*-
2*40865Sbostic  * Copyright (c) 1979 The Regents of the University of California.
3*40865Sbostic  * All rights reserved.
4*40865Sbostic  *
5*40865Sbostic  * %sccs.include.redist.c%
6*40865Sbostic  */
71712Smckusick 
8*40865Sbostic #ifndef lint
9*40865Sbostic static char sccsid[] = "@(#)UNIT.c	1.3 (Berkeley) 04/09/90";
10*40865Sbostic #endif /* not lint */
111712Smckusick 
121712Smckusick #include "h00vars.h"
131712Smckusick 
141712Smckusick struct iorec *
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