
/*
 * cpydata.c -- copy from one fd to another
 *
 * $Id$
 */

#include <h/mh.h>

void
cpydata (int in, int out, char *ifile, char *ofile)
{
    register int i;
    char buffer[BUFSIZ];

    while ((i = read(in, buffer, sizeof buffer)) > 0)
	if (write(out, buffer, i) != i)
	    adios(ofile, "error writing");

    if (i == NOTOK)
	adios(ifile, "error reading");
}
