File:  [MW Coherent from dump] / coherent / d / lib / libc / stdio / fwrite.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:38 2019 UTC (7 years, 2 months ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

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

#include <stdio.h>

int
fwrite(bp, size, nitems, fp)
register unsigned char	*bp;
unsigned 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);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.