BSD 4_4_Lite2 development
[unix-history] / usr / src / contrib / mh-6.8.3a / sbr / cpydata.c
CommitLineData
3b5b17f7
C
1/* cpydata.c - copy from one fd to another */
2
3#include "../h/mh.h"
4#include <stdio.h>
5
6
7void cpydata (in, out, ifile, ofile)
8register int in,
9 out;
10register 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}