/* copy2.c */

#include <stdio.h>

int main(int argc, char *argv[] )
{
  int buff;
 
   if (argc > 1)
    if ( freopen(argv[1], "rt", stdin) == NULL)
     {
      perror("freopen");
      exit(1); 
     } /* if */

   if (argc > 2)
    if ( freopen(argv[2], "wt", stdout) == NULL)
     {
      perror("freopen");
      exit(1); 
     } /* if */

   
   while ( (buff = getchar()) != EOF ) /* read until Ctrl-D */
      putchar(buff);


} /* main */
