/***********************************************************************\
 *                                                                       *
 *   COPYDATA.C    Copyright (C) 1993 Sequiter Software Inc.             *
 *                                                                       *
 \***********************************************************************/
/* See User's Manual, page 70 */


#include "d4all.h"

#ifdef __TURBOC__
extern unsigned _stklen = 10000;
#endif

void main(int argc,char *argv[])
{
  CODE4      code_base;
  DATA4      *data_file,*data_copy;
  FIELD4INFO *field_info;

  if(argc != 3) 
  {
    printf("USAGE: COPYDATA <FROM FILE> "
           "<TO FILE>" ) ;
    exit(1);
  }

  d4init(&code_base);
  code_base.safety = 0;

  data_file = d4open(&code_base,argv[1]);
  e4exit_test(&code_base);

  field_info = d4field_info(data_file);
  
  data_copy = d4create(&code_base,argv[2]
                       ,field_info,0);
  
  u4free(field_info);
  
  d4close_all(&code_base);

  exit(1) ;
}
