/* plt_bin.c : lancement de splt_irv 
               routine graphique associee au programme de
               recherche de periode
 */

#include <stdio.h>

main(argc,argv)
 int argc;
 char *argv[];
{
 int status, flag, noet, atoi();
 double vsys, atof();
 char plt[12], orb[12], com[50];
 char arg1[4], arg2[7], arg3[8];
 char *argt[9];
 char *plot, *getenv();

 plot = getenv("PLOT");

 if( (strcmp(plot,"sm")) == 0) {
   flag=atoi(argv[1]);
   noet=atoi(argv[2]);
   vsys=atof(argv[3]);

   printf(" %2d  %4d  %5.2f\n",flag,noet,vsys);

   sprintf(arg1,"%1d",flag);
   sprintf(plt,"e%04d.plt",noet);
   sprintf(orb,"e%04d.orb",noet);
   sprintf(arg2,"%04d",noet);
   sprintf(arg3,"%5.2f",vsys);

   printf(" arg1:    %s\n", arg1);
   printf(" fichier: %s\n", plt);
   printf(" fichier: %s\n", orb);
   printf(" arg2:    %s\n", arg2);
   printf(" arg3:    %s\n", arg3);
   
   argt[0]="splt_irv";
   argt[1]=arg1;
   argt[2]=plt;
   argt[3]=orb;
   argt[4]=" ";
   argt[5]=arg2;
   argt[6]=arg3;
   argt[7]=" ";
   argt[8]=(char *)0;
 
   execvp("splt_irv",argt);
  }
 else {
   sprintf(com,"mplt_bin %1d %04d %5.2f",flag,noet,vsys);
   system(com);
  }
 }
