Mercurial > hg > Members > kono > os9 > sbc09
annotate mc09/test/cp.c @ 161:91447c3ccd58
fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 12 Feb 2019 09:16:24 +0900 |
parents | 1a30cd6e5973 |
children |
rev | line source |
---|---|
107 | 1 #include "mclibos9.c" |
2 | |
3 int | |
4 main(argc,argv) | |
5 int argc;char *argv[]; { | |
6 FILE *input ; | |
7 FILE *output ; | |
8 int c; | |
9 int i; | |
10 | |
132 | 11 input = stdin; |
12 output = stdout; | |
107 | 13 |
14 i = 1; | |
15 if (argv[i]) { input = fopen(argv[i++],"r"); } | |
16 if (argv[i]) { output = fopen(argv[i++],"w"); } | |
132 | 17 if (input==0 || output==0) return 0; |
107 | 18 while( (c = getc(input) ) != -1) { |
19 putc(c,output); | |
20 } | |
21 return 1; | |
22 } |