|
|
1.1 ! root 1: #define BSIZE 4096 ! 2: #define min(a,b) ((a)<(b) ? (a) : (b)) ! 3: ! 4: fcopy(to, from, nbytes) ! 5: int to, from; register int nbytes; ! 6: { ! 7: char *malloc(); ! 8: register char *buf; register int n; ! 9: ! 10: if (nbytes && (buf = malloc(min(nbytes, BSIZE)))) { ! 11: do { ! 12: n = min(nbytes, BSIZE); ! 13: if (read(from, buf, n) != n) break; ! 14: if (write(to, buf, n) != n) break; ! 15: nbytes -= n; ! 16: } while (nbytes); ! 17: free(buf); ! 18: } ! 19: return nbytes; ! 20: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.