#include <exec/types.h>
#include <stdio.h>
#include <exec/memory.h>
#include "libraries/dos.h"
#include "exec/exec.h"
#include "intuition/intuitionbase.h"
#include "devices/keymap.h"
#include <string.h>
#include <ctype.h>
#include <stdlib.h>

#include "mcadicon.h"
struct IntuitionBase *IntuitionBase;
struct IconBase *IconBase;


char plot_name[100];
char mcad_name[100];
char Command[200];



void main(argc,argv)
int argc;
char *argv[];
{


  /*** PARSE ARGS ***/

  if ((argv[1][0] == '?')||(argc!=3))
     {
        printf("usage: Plot2mCAD infile outfile\n");
        exit(0);
     }
   else
     {
       strcpy(plot_name,argv[1]);
       strcpy(mcad_name,argv[2]);
     }

   /*** OPEN LIBRARIES ***/

   if (!(IntuitionBase = OpenLibrary("intuition.library",0))) {
      printf("Can't open intuition library...\n");
      exit(0);
   }
   if (!(IconBase = OpenLibrary("icon.library", 0))) {
      printf("Can't open icon library...\n");
      CloseLibrary(IntuitionBase);
      exit(0);
   }

  /********           MOVE FILE         *******/

   sprintf(Command,"copy %s to %s",plot_name,mcad_name);
   Execute(Command,0,0);

  /*******            ADD ICON         ********/

  PutDiskObject(mcad_name,&IconDiskObject);

   CloseLibrary(IntuitionBase);
   CloseLibrary(IconBase);

}

