Debian Codegraph @

benchmarks.larceny/src/cat.c

raw
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 int main(int argc, char *argv[]) {
5 int c;
6 FILE *infp;
7 FILE *outfp;
8 char *infile = "../../src/bib";
9 char *outfile = "foo";
10 if (argc > 1)
11 infile = argv[1];
12 if (argc > 2)
13 outfile = argv[2];
14 infp = fopen(infile, "r");
15 if (infp == NULL) {
16 fprintf(stderr, "can't open %s\n", infile);
17 exit(1);
18 }
19 outfp = fopen(outfile, "w");
20 if (outfp == NULL) {
21 fprintf(stderr, "can't open %s\n", outfile);
22 exit(1);
23 }
24 while ((c = getc(infp)) != EOF)
25 putc(c, outfp);
26 return 0;
27 }