xref: /original-bsd/usr.bin/pascal/libpc/UNSYNC.c (revision 6c57d260)
1 /* Copyright (c) 1979 Regents of the University of California */
2 
3 static char sccsid[] = "@(#)UNSYNC.c 1.2 01/24/81";
4 
5 #include "h00vars.h"
6 #include "h01errs.h"
7 
8 /*
9  * push back last char read to prepare for formatted read
10  */
11 UNSYNC(curfile)
12 
13 	register struct iorec	*curfile;
14 {
15 	if (curfile->funit & FWRITE) {
16 		ERROR(EREADIT, curfile->pfname);
17 		return;
18 	}
19 	if (curfile->funit & EOFF) {
20 		ERROR(EPASTEOF, curfile->pfname);
21 		return;
22 	}
23 	if ((curfile->funit & SYNC) == 0) {
24 		ungetc(*curfile->fileptr, curfile->fbuf);
25 	}
26 }
27