Mercurial > hg > Applications > mh
annotate sbr/cpydata.c @ 3:f89a9a79e124
utf-8
author | kono |
---|---|
date | Wed, 20 Apr 2005 00:25:01 +0900 |
parents | bce86c4163a3 |
children |
rev | line source |
---|---|
0 | 1 /* cpydata.c - copy from one fd to another */ |
2 | |
3 #include "../h/mh.h" | |
4 #include <stdio.h> | |
5 | |
6 | |
7 void cpydata (in, out, ifile, ofile) | |
8 register int in, | |
9 out; | |
10 register 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 } |