/*  Hipparcos ASCII CD-ROM load and search routines Release 1.1 June 1997
    William O'Mullane 
    Astrophysics Division, ESTEC, Noordwijk, The Netherlands. 
    See the readme.pdf file for more information */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "utils.h" 
 
#include "isolar.h" 
#include "solar_hp.h"
#include "solar_ha.h"
#include "solar_t.h"

main (int argc,char **argv)
{
   FILE* solarhpfp;
   FILE* solarhafp;
   FILE* solartfp;
   if (argc == 1) 
   { 
        fprintf (stderr,"You must pass a key value on the command line \n");
   }
   else /* some numbers on the command line */
   { 
	int i,decode=ASRAW,cols=0,quite=0;
	long multiRecs=0,recNo;
	FILE* dataFile;
	for (i=1; i<argc ; i++)
	{
	   INT rec; 
	   idx_solar *idxEntry;
   	   checkIfCommandLineFlag(argv,argc,&i,&cols,&decode,&quite,&multiRecs);
	   

		strAsINT( argv[i], &rec);
		if ( (idxEntry = find_idx_solar(&rec)) != NULL)
		{ 
	   	if ( idxEntry->HP.value >= 0 ) 
		   {
			array_solar_hp recs;	
			read_array_solar_hp(idxEntry->HP_NUM.value,&recs,&idxEntry->HP);
			if (cols)
			   print_array_solar_hp_cols(&recs,decode);
			else
			   print_array_solar_hp(&recs,decode);
		   }

	   	if ( idxEntry->HA.value >= 0 ) 
		   {
			array_solar_ha recs;	
			read_array_solar_ha(idxEntry->HA_NUM.value,&recs,&idxEntry->HA);
			if (cols)
			   print_array_solar_ha_cols(&recs,decode);
			else
			   print_array_solar_ha(&recs,decode);
		   }

	   	if ( idxEntry->T.value >= 0 ) 
		   {
			array_solar_t recs;	
			read_array_solar_t(idxEntry->T_NUM.value,&recs,&idxEntry->T);
			if (cols)
			   print_array_solar_t_cols(&recs,decode);
			else
			   print_array_solar_t(&recs,decode);
		   }

		}

	   else
	      printf("%d not found\n",rec.value);
	}
   }
 
} /* End Main for idx_solar_test */

