Commit | Line | Data |
---|---|---|
fe4a0cc6 KM |
1 | /* |
2 | * Copyright (c) 1986 Regents of the University of California. | |
78a3c717 KB |
3 | * All rights reserved. |
4 | * | |
5 | * Redistribution and use in source and binary forms are permitted | |
6 | * provided that this notice is preserved and that due credit is given | |
7 | * to the University of California at Berkeley. The name of the University | |
8 | * may not be used to endorse or promote products derived from this | |
9 | * software without specific prior written permission. This software | |
10 | * is provided ``as is'' without express or implied warranty. | |
fe4a0cc6 KM |
11 | */ |
12 | ||
13 | #ifndef lint | |
14 | char copyright[] = | |
15 | "@(#) Copyright (c) 1986 Regents of the University of California.\n\ | |
16 | All rights reserved.\n"; | |
78a3c717 | 17 | #endif /* not lint */ |
fe4a0cc6 KM |
18 | |
19 | #ifndef lint | |
78a3c717 KB |
20 | static char sccsid[] = "@(#)20b.c 5.2 (Berkeley) %G%"; |
21 | #endif /* not lint */ | |
fe4a0cc6 | 22 | |
78a3c717 | 23 | #define BSIZE (20 * 512) |
fe4a0cc6 KM |
24 | main() |
25 | { | |
26 | register char *base, *current; | |
27 | register int cc, want; | |
fe4a0cc6 KM |
28 | char *alloca(); |
29 | ||
78a3c717 KB |
30 | base = alloca(BSIZE); |
31 | for (cc = BSIZE; cc > 0;) { | |
fe4a0cc6 | 32 | current = base; |
78a3c717 KB |
33 | for (want = BSIZE; want > 0 && cc > 0; want -= cc) { |
34 | if ((cc = read(0, current, want)) < 0) | |
35 | return(-1); | |
fe4a0cc6 KM |
36 | current += cc; |
37 | } | |
78a3c717 KB |
38 | want = BSIZE - want; |
39 | if (want && write(1, base, want) != want) | |
40 | return(-1); | |
fe4a0cc6 KM |
41 | } |
42 | return(0); | |
43 | } |