|
|
1.1 ! root 1: /* ! 2: * iread - insistent read. Same usage as read, but will always return ! 3: * either the exact number of bytes requested, 0, or -1, unless a call ! 4: * to read gets some data and a subsequent call returns 0. ! 5: */ ! 6: int ! 7: iread (fd, buf, n) ! 8: int fd, n; ! 9: register char *buf; ! 10: { ! 11: register int r, offset; ! 12: ! 13: r = read (fd, buf, n); ! 14: if (r <= 0) ! 15: return r; ! 16: offset = 0; ! 17: while (r != n - offset && r > 0) { ! 18: offset += r; ! 19: r = read (fd, buf + offset, n - offset); ! 20: } ! 21: return r < 0? r: r + offset; ! 22: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.