Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / sbr / cpydata.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 }