X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fcpydata.c;h=9cd8d38b3de8077379d8da67383b43fcec915372;hp=a8c33758890431cd224e507b1d2c8d2f3fa42765;hb=31750e8a12eafcd1b8fa81cb12b988e680254f24;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b diff --git a/sbr/cpydata.c b/sbr/cpydata.c index a8c3375..9cd8d38 100644 --- a/sbr/cpydata.c +++ b/sbr/cpydata.c @@ -1,23 +1,26 @@ - /* - * cpydata.c -- copy all data from one fd to another - * - * $Id$ - */ +** cpydata.c -- copy all data from one fd to another +** +** This code is Copyright (c) 2002, by the authors of nmh. See the +** COPYRIGHT file in the root directory of the nmh distribution for +** complete copyright information. +*/ +#include +#include #include void -cpydata (int in, int out, char *ifile, char *ofile) +cpydata(int in, int out, char *ifile, char *ofile) { - int i; - char buffer[BUFSIZ]; + int i; + char buffer[BUFSIZ]; - while ((i = read(in, buffer, sizeof(buffer))) > 0) { - if (write(out, buffer, i) != i) - adios(ofile, "error writing"); - } + while ((i = read(in, buffer, sizeof(buffer))) > 0) { + if (write(out, buffer, i) != i) + adios(EX_IOERR, ofile, "error writing"); + } - if (i == -1) - adios(ifile, "error reading"); + if (i == -1) + adios(EX_IOERR, ifile, "error reading"); }