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

        Copiature di file Variante 2
           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 2: Utilizzo dell'IO Standard
La lettura e scrittura hanno luogo riga per riga
(Non adatto per file binari)

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

#include <stdio.h>

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

void main()
{
  char filna[60],zeile[100],*hadr;
  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)
    {
     hadr = fgets(zeile,100,ifil);
     if (hadr == NULL) break;
     ic = fputs(zeile,ofil);
     if (ic == EOF) abbruch("Errore Scrittura");
    }

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