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

⟦42ed966c6⟧ TextFile

    Length: 559 (0x22f)
    Types: TextFile
    Notes: UNIX file
    Names: »_fgetb.c«

Derivation

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

TextFile

/*
 * Standard I/O Library Internals
 * Buffered Input; read a bufferfull
 */

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

int
_fgetb(fp)
register FILE	*fp;
{
	extern	int	_fputt();

	if (fflush(fp))
		return (EOF);
	if (stdout->_pt==&_fputt)	/* special kludge */
		fflush(stdout);
	errno = 0;
	if ((fp->_cc = -read(fileno(fp), fp->_dp, _ep(fp) - fp->_dp)) == 1) {
		if (errno != EINTR)
			fp->_ff |= _FERR;
		fp->_cc = 0;
		return (EOF);
	} else if (fp->_cc == 0) {
		fp->_ff |= _FEOF;
		return (EOF);
	} else {
		fp->_dp -= fp->_cc++;
		return (*fp->_cp++);
	}
}