DataMuseum.dk

Presents historical artifacts from the history of:

Commodore CBM-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Commodore CBM-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦533468a91⟧ TextFile

    Length: 515 (0x203)
    Types: TextFile
    Notes: UNIX file
    Names: »fflush.c«

Derivation

└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
    └─⟦f4b8d8c84⟧ UNIX V7 Filesystem
        └─ ⟦this⟧ »libc/stdio/fflush.c« 

TextFile

/*
 * Standard I/O Library
 * Write out any unwritten data in buffer
 */

#include <stdio.h>
#include <errno.h>

int
fflush(fp)
register FILE	*fp;
{
	register int	cc;

	fp->_cc = 0;
	errno = 0;
	if (fp->_ff&_FERR) {
		return (EOF);
	} else if ((cc = fp->_cp - fp->_dp) <= 0
	 || write(fileno(fp), fp->_dp, cc) == cc
	 || errno == EINTR) {
		if (cc < 0)
			;
		else if (fp->_cp == _ep(fp))
			fp->_dp = fp->_cp = fp->_bp;
		else
			fp->_dp = fp->_cp;
		return (0);
	} else {
		fp->_ff |= _FERR;
		return (EOF);
	}
}