move the text of error messages from ERROR to the functions
[unix-history] / usr / src / usr.bin / pascal / libpc / UNSYNC.c
CommitLineData
0befb875
KM
1/* Copyright (c) 1979 Regents of the University of California */
2
86997b19 3static char sccsid[] = "@(#)UNSYNC.c 1.3 %G%";
0befb875
KM
4
5#include "h00vars.h"
0befb875
KM
6
7/*
8 * push back last char read to prepare for formatted read
9 */
10UNSYNC(curfile)
11
12 register struct iorec *curfile;
13{
14 if (curfile->funit & FWRITE) {
86997b19
KM
15 ERROR("%s: Attempt to read, but open for writing\n",
16 curfile->pfname);
0befb875
KM
17 return;
18 }
a7f2537e 19 if (curfile->funit & EOFF) {
86997b19 20 ERROR("%s: Tried to read past end of file\n", curfile->pfname);
a7f2537e
KM
21 return;
22 }
0befb875
KM
23 if ((curfile->funit & SYNC) == 0) {
24 ungetc(*curfile->fileptr, curfile->fbuf);
25 }
26}