Annotation of researchv10no/netfs/libnetb/gread.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * gather data that may come in dribs and drabs:
        !             3:  * read size bytes into buf,
        !             4:  * but keep looking until at least minsize have arrived
        !             5:  */
        !             6: #include <errno.h>     /* just for EINTR */
        !             7: 
        !             8: int
        !             9: _rfgread(fd, buf, size, minsize)
        !            10: int fd;
        !            11: char *buf;
        !            12: int size;
        !            13: register int minsize;
        !            14: {
        !            15:        register int n, tot;
        !            16:        extern int errno;
        !            17: 
        !            18:        tot = 0;
        !            19:        while (minsize > 0) {
        !            20:                if ((n = read(fd, buf, size)) <= 0) {
        !            21:                        if (errno == EINTR)
        !            22:                                continue;
        !            23:                        break;
        !            24:                }
        !            25:                buf += n;
        !            26:                size -= n;
        !            27:                minsize -= n;
        !            28:                tot += n;
        !            29:        }
        !            30:        if (tot)
        !            31:                return (tot);
        !            32:        return (n);
        !            33: }

unix.superglobalmegacorp.com

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