/*
 * 5799-WZQ (C) COPYRIGHT = NONE
 * LICENSED MATERIALS - PROPERTY OF IBM
 */
/* $Header:UNSYNC.c 12.0$ */
/* $ACIS:UNSYNC.c 12.0$ */
/* $Source: /ibm/acis/usr/src/usr.lib/libpc/RCS/UNSYNC.c,v $ */

#ifndef lint
static char *rcsid = "$Header:UNSYNC.c 12.0$";
#endif

/* Copyright (c) 1979 Regents of the University of California */

static char sccsid[] = "@(#)UNSYNC.c 1.4 10/28/83";

#include "h00vars.h"

/*
 * push back last char read to prepare for formatted read
 */
UNSYNC(curfile)

	register struct iorec	*curfile;
{
	if (curfile->funit & FWRITE) {
		ERROR("%s: Attempt to read, but open for writing\n",
			curfile->pfname);
		return;
	}
	if (curfile->funit & EOFF) {
		ERROR("%s: Tried to read past end of file\n", curfile->pfname);
		return;
	}
	if ((curfile->funit & SYNC) == 0) {
		ungetc(*curfile->fileptr, curfile->fbuf);
	}
	curfile->funit &= ~EOLN;
	curfile->funit |= SYNC;
}
