Allow the user to quit the program with the window close gadgets.
[AROS.git] / test / minicat.c
blob2e991fae494c84f33ea74c1baacaccc10ff307d4
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)) == BNULL) {
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;