Annotation of coherent/d/lib/libc/stdio/fwrite.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Standard I/O Library
        !             3:  * Write nitems of size to file fp
        !             4:  */
        !             5: 
        !             6: #include <stdio.h>
        !             7: 
        !             8: int
        !             9: fwrite(bp, size, nitems, fp)
        !            10: register unsigned char *bp;
        !            11: unsigned int   size, nitems;
        !            12: register FILE  *fp;
        !            13: {
        !            14:        register unsigned int   nb = size*nitems;
        !            15: 
        !            16:        if (fp->_ff&_FUNGOT)
        !            17:                (*fp->_gt)(fp);
        !            18:        if (fp->_bp!=NULL || !(fp->_ff&_FSTBUF)) {
        !            19:                for (; nb && putc(*bp++, fp)!=EOF; nb--)
        !            20:                        ;
        !            21:                if (nb)
        !            22:                        return (0);
        !            23:                else
        !            24:                        return (nitems);
        !            25:        } else if (write(fileno(fp), bp, nb) != nb) {
        !            26:                fp->_ff |= _FERR;
        !            27:                return (0);
        !            28:        } else
        !            29:                return (nitems);
        !            30: }

unix.superglobalmegacorp.com

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