fix auto-quoting screwup
[unix-history] / usr / src / sys / stand.att / docopy.c
CommitLineData
777c02a3
KB
1/*
2 * Copyright (c) 1988 Regents of the University of California.
3 * All rights reserved.
4 *
dbf0c423 5 * %sccs.include.redist.c%
777c02a3 6 *
dbf0c423 7 * @(#)docopy.c 7.3 (Berkeley) %G%
777c02a3 8 */
9c50374f 9
777c02a3
KB
10#define SIZE 10240
11
12docopy(from, to, nrecs)
13 register int from, to, nrecs;
14{
15 register int record, rcc, wcc;
16 char buf[SIZE];
17
18 for (record = 0;;) {
19 if (!(rcc = read(from, buffer, SIZE)))
20 break;
21 if (rcc < 0) {
22 printf("Record %d: read error, errno=%d\n",
23 record, errno);
24 break;
25 }
26 if (rcc < SIZE)
27 printf("Record %d: read short; expected %d, got %d\n",
28 record, SIZE, rcc);
29#ifdef vax
30 /* For bug in ht driver. */
31 if (rcc > SIZE)
32 rcc = SIZE;
33#endif
34 if ((wcc = write(to, buffer, rcc)) < 0) {
35 printf("Record %d: write error: errno=%d\n",
36 record, errno);
37 break;
38 }
39 if (wcc < rcc) {
40 printf("Record %d: write short; expected %d, got %d\n",
41 record, rcc, wcc);
42 break;
43 }
44 if (nrecs > 0 && ++record == nrecs)
45 break;
46 }
47 printf("copy completed: %d records copied\n", record);
48}