]> diplodocus.org Git - nmh/blob - sbr/cpydata.c
Add support for a -nosasl switch.
[nmh] / sbr / cpydata.c
1
2 /*
3 * cpydata.c -- copy all data from one fd to another
4 *
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
8 */
9
10 #include <h/mh.h>
11
12 void
13 cpydata (int in, int out, char *ifile, char *ofile)
14 {
15 int i;
16 char buffer[BUFSIZ];
17
18 while ((i = read(in, buffer, sizeof(buffer))) > 0) {
19 if (write(out, buffer, i) != i)
20 adios(ofile, "error writing");
21 }
22
23 if (i == -1)
24 adios(ifile, "error reading");
25 }