1 /* Copyright (c) 1979 Regents of the University of California */ 2 3 static char sccsid[] = "@(#)FNIL.c 1.1 10/30/80"; 4 5 #include "h00vars.h" 6 #include "h01errs.h" 7 8 char * 9 FNIL(curfile) 10 11 register struct iorec *curfile; 12 { 13 if (curfile->fblk >= MAXFILES || _actfile[curfile->fblk] != curfile) { 14 ERROR(ENOFILE, 0); 15 return; 16 } 17 if (curfile->funit & FDEF) { 18 ERROR(EREFINAF, curfile->pfname); 19 return; 20 } 21 if (curfile->funit & FREAD) { 22 IOSYNC(curfile); 23 if (curfile->funit & EOFF) { 24 ERROR(EPASTEOF, curfile->pfname); 25 return; 26 } 27 } 28 return curfile->fileptr; 29 } 30