view sbr/cpydata.c @ 17:76d91e545ea8 default tip

addrsbr and dtimep fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 24 Nov 2014 14:49:25 +0900
parents bce86c4163a3
children
line wrap: on
line source

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

#include "../h/mh.h"
#include <stdio.h>


void cpydata (in, out, ifile, ofile)
register int    in,
                out;
register char  *ifile,
               *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");
}