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

⟦4b5d7d91d⟧ TextFile

    Length: 523 (0x20b)
    Types: TextFile
    Notes: UNIX file
    Names: »fwrite.c«

Derivation

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

TextFile

/*
 * Standard I/O Library
 * Write nitems of size to file fp
 */

#include <stdio.h>

int
fwrite(bp, size, nitems, fp)
register unsigned char	*bp;
int	size, nitems;
register FILE	*fp;
{
	register unsigned int	nb = size*nitems;

	if (fp->_ff&_FUNGOT)
		(*fp->_gt)(fp);
	if (fp->_bp!=NULL || !(fp->_ff&_FSTBUF)) {
		for (; nb && putc(*bp++, fp)!=EOF; nb--)
			;
		if (nb)
			return (0);
		else
			return (nitems);
	} else if (write(fileno(fp), bp, nb) != nb) {
		fp->_ff |= _FERR;
		return (0);
	} else
		return (nitems);
}