11714Smckusick /* Copyright (c) 1979 Regents of the University of California */
21714Smckusick 
3*3869Smckusic static char sccsid[] = "@(#)UNSYNC.c 1.3 06/10/81";
41714Smckusick 
51714Smckusick #include "h00vars.h"
61714Smckusick 
71714Smckusick /*
81714Smckusick  * push back last char read to prepare for formatted read
91714Smckusick  */
101714Smckusick UNSYNC(curfile)
111714Smckusick 
121714Smckusick 	register struct iorec	*curfile;
131714Smckusick {
141714Smckusick 	if (curfile->funit & FWRITE) {
15*3869Smckusic 		ERROR("%s: Attempt to read, but open for writing\n",
16*3869Smckusic 			curfile->pfname);
171714Smckusick 		return;
181714Smckusick 	}
192224Smckusic 	if (curfile->funit & EOFF) {
20*3869Smckusic 		ERROR("%s: Tried to read past end of file\n", curfile->pfname);
212224Smckusic 		return;
222224Smckusic 	}
231714Smckusick 	if ((curfile->funit & SYNC) == 0) {
241714Smckusick 		ungetc(*curfile->fileptr, curfile->fbuf);
251714Smckusick 	}
261714Smckusick }
27