+
+ if (argc == 3)
+ {
+ in = fopen(argv[1], "r");
+ if (!in)
+ {
+ fprintf(stderr, "Error opening input file\n");
+ exit(1);
+ }
+ out = fopen(argv[2], "w");
+ if (!out)
+ {
+ fprintf(stderr, "Error opening output file\n");
+ exit(1);
+ }
+ }
+ else if (argc == 1)
+ {
+ in = stdin;
+ out = stdout;
+ }
+ else
+ {
+ fprintf(stderr,"%s (infile outfile)\n",argv[0]);
+ exit(1);
+ }
+
+ while (fgets(buf, sizeof(buf), in) != NULL)