Commit | Line | Data |
---|---|---|
3b5b17f7 C |
1 | /* cpydata.c - copy from one fd to another */ |
2 | ||
3 | #include "../h/mh.h" | |
4 | #include <stdio.h> | |
5 | ||
6 | ||
7 | void cpydata (in, out, ifile, ofile) | |
8 | register int in, | |
9 | out; | |
10 | register char *ifile, | |
11 | *ofile; | |
12 | { | |
13 | register int i; | |
14 | char buffer[BUFSIZ]; | |
15 | ||
16 | while ((i = read (in, buffer, sizeof buffer)) > 0) | |
17 | if (write (out, buffer, i) != i) | |
18 | adios (ofile, "error writing"); | |
19 | ||
20 | if (i == NOTOK) | |
21 | adios (ifile, "error reading"); | |
22 | } |