11714Smckusick /* Copyright (c) 1979 Regents of the University of California */
21714Smckusick 
3*2224Smckusic static char sccsid[] = "@(#)UNSYNC.c 1.2 01/24/81";
41714Smckusick 
51714Smckusick #include "h00vars.h"
61714Smckusick #include "h01errs.h"
71714Smckusick 
81714Smckusick /*
91714Smckusick  * push back last char read to prepare for formatted read
101714Smckusick  */
111714Smckusick UNSYNC(curfile)
121714Smckusick 
131714Smckusick 	register struct iorec	*curfile;
141714Smckusick {
151714Smckusick 	if (curfile->funit & FWRITE) {
161714Smckusick 		ERROR(EREADIT, curfile->pfname);
171714Smckusick 		return;
181714Smckusick 	}
19*2224Smckusic 	if (curfile->funit & EOFF) {
20*2224Smckusic 		ERROR(EPASTEOF, curfile->pfname);
21*2224Smckusic 		return;
22*2224Smckusic 	}
231714Smckusick 	if ((curfile->funit & SYNC) == 0) {
241714Smckusick 		ungetc(*curfile->fileptr, curfile->fbuf);
251714Smckusick 	}
261714Smckusick }
27