- while(!feof(in)) {
- read = fread(buf, 1, sizeof(buf), in);
- if(ferror(in))
- return(-1);
- if(fwrite(buf, 1, read, out) != read)
+ while(!bioeof(in)) {
+ if((read = biordata(in)) > 0) {
+ if((read = biowritesome(out, in->rbuf.b + in->rh, read)) < 0)
+ return(-1);
+ in->rh += read;
+ total += read;
+ }
+ if(biorspace(in) && (biofillsome(in) < 0))