1*40865Sbostic /*- 2*40865Sbostic * Copyright (c) 1979 The Regents of the University of California. 3*40865Sbostic * All rights reserved. 4*40865Sbostic * 5*40865Sbostic * %sccs.include.redist.c% 6*40865Sbostic */ 71714Smckusick 8*40865Sbostic #ifndef lint 9*40865Sbostic static char sccsid[] = "@(#)UNSYNC.c 1.5 (Berkeley) 04/09/90"; 10*40865Sbostic #endif /* not lint */ 111714Smckusick 121714Smckusick #include "h00vars.h" 131714Smckusick 141714Smckusick /* 151714Smckusick * push back last char read to prepare for formatted read 161714Smckusick */ 171714Smckusick UNSYNC(curfile) 181714Smckusick 191714Smckusick register struct iorec *curfile; 201714Smckusick { 211714Smckusick if (curfile->funit & FWRITE) { 223869Smckusic ERROR("%s: Attempt to read, but open for writing\n", 233869Smckusic curfile->pfname); 241714Smckusick return; 251714Smckusick } 262224Smckusic if (curfile->funit & EOFF) { 273869Smckusic ERROR("%s: Tried to read past end of file\n", curfile->pfname); 282224Smckusic return; 292224Smckusic } 301714Smckusick if ((curfile->funit & SYNC) == 0) { 311714Smckusick ungetc(*curfile->fileptr, curfile->fbuf); 321714Smckusick } 3315303Smckusick curfile->funit &= ~EOLN; 3415303Smckusick curfile->funit |= SYNC; 351714Smckusick } 36