source: trunk/third/nmh/sbr/cpydata.c @ 12455

Revision 12455, 423 bytes checked in by danw, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12454, which included commits to RCS files with non-trunk default branches.
Line 
1
2/*
3 * cpydata.c -- copy all data from one fd to another
4 *
5 * $Id: cpydata.c,v 1.1.1.1 1999-02-07 18:14:07 danw Exp $
6 */
7
8#include <h/mh.h>
9
10void
11cpydata (int in, int out, char *ifile, char *ofile)
12{
13    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
21    if (i == -1)
22        adios(ifile, "error reading");
23}
Note: See TracBrowser for help on using the repository browser.