squashed commit of private hostlib-resource branch
[tangerine.git] / test / minicat.c
blob81a787a02d5da89beea1e152ca497467603a23e7
1 #include <stdio.h>
2 #include <exec/types.h>
3 #include <dos/dos.h>
4 #include <dos/dosextens.h>
5 #include <dos/bptr.h>
6 #include <proto/dos.h>
8 int main(int argc, char **argv) {
9 BPTR in, out;
10 char buf[256];
11 LONG len;
13 if (argc > 1) {
14 if ((in = Open(argv[1], MODE_OLDFILE)) == NULL) {
15 Fault(IoErr(), "minicat", buf, 255);
16 fprintf(stderr, "%s\n", buf);
17 return 1;
20 else
21 in = Input();
23 out = Output();
25 while ((len = Read(in, buf, 256)) > 0)
26 Write(out, buf, len);
28 if (argc > 1)
29 Close(in);
31 return 0;