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

⟦9cd5f53c3⟧ TextFile

    Length: 465 (0x1d1)
    Types: TextFile
    Notes: UNIX file
    Names: »_fgetc.c«

Derivation

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

TextFile

/*
 * Standard I/O Library Internals
 * Unbuffered input
 */

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

int
_fgetc(fp)
register FILE	*fp;
{
	register unsigned char	s[1];
	extern	int	_fputt();

	if (stdout->_pt==&_fputt)		/* special kludge */
		fflush(stdout);
	fp->_cc = 0;
	errno = 0;
	switch (read(fileno(fp), s, 1)) {
	case -1:
		if (errno != EINTR)
			fp->_ff |= _FERR;
		break;
	case 0:
		fp->_ff |= _FEOF;
		break;
	default:
		return (s[0]);
	}
	return (EOF);
}