/***************************************

        Copiatore di file Variante 1
           last update 10/07/87
      AMIGA-Version by Frank Kremser
PC-Original-Version by Dr. Edgar Huckert
       (C) 1987  by Markt & Technik

****************************************

Copia di file: Variante 1: Utilizzo dell'IO standard
La lettura e scrittura hanno luogo per carattere
(Non adatto a file binari)

***************************************/

#include <stdio.h>

void abbruch(str)
char *str;
{
  fprintf(stderr,"\n--- %s ---\n",str);
  exit(1);
}   /* fine */

void main()
{
  char filna[60];
  FILE *ifil,*ofil;
  int ic;

  fprintf(stderr,"\nInputfile:");
  gets(filna);
  ifil = fopen(filna,"r");
  if (ifil == NULL) abbruch("Errore Inputfile");
  fprintf(stderr,"\nNome della Copia:");
  gets(filna);
  ofil = fopen(filna,"w");
  if (ofil == NULL) abbruch("Errore Outputfile");

  while (1)
    {
     ic = fgetc(ifil);
     if (ic == EOF) break;
     ic = fputc(ic,ofil);
     if (ic == EOF) abbruch("Errore Scrittura");
    }

  fclose(ifil);
  fclose(ofil);
}   /* end main */
