< | Diciembre 2024 | |||||
Lu | Ma | Mi | Ju | Vi | Sa | Do |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
int copy1(int fdf, int fdt, char *from, char *to) { char *buf; long n, n1, rcount; int rv; char err[ERRMAX]; buf = malloc(DEFB); /* clear any residual error */ err[0] = ''; errstr(err, ERRMAX); rv = 0; for(rcount=0;; rcount++) { n = read(fdf, buf, DEFB); if(n <= 0) break; n1 = write(fdt, buf, n); if(n1 != n) { fprint(2, "cp: error writing %s: %r\n", to); failed = 1; rv = -1; break; } } if(n < 0) { fprint(2, "cp: error reading %s: %r\n", from); failed = 1; rv = -1; } free(buf); return rv; }