# include "uniphot.h"

void ConfigInit (int *argc, char **argv) {

  double ZERO_POINT;
  char  *config, *file;
  char   PhotCodeFile[256];

  /*** load configuration info ***/
  file = SelectConfigFile (argc, argv, "ptolemy");
  config = LoadConfigFile (file);
  if (config == (char *) NULL) {
    fprintf (stderr, "ERROR: can't find configuration file %s\n", file);
    if (file != (char *) NULL) free (file);
    exit (0);
  }
  if (VERBOSE) fprintf (stderr, "loaded config file: %s\n", file);

  ScanConfig (config, "CATDIR",                 "%s",  0, CATDIR);
  ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
  ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
  sprintf (ImageCat, "%s/Images.dat", CATDIR);

  ScanConfig (config, "PHOTCODE_FILE",          "%s",  0, PhotCodeFile);
  ScanConfig (config, "ZERO_PT",                "%lf", 0, &ZERO_POINT);
  SetZeroPoint (ZERO_POINT);

  free (config);
  free (file);

  if (*CATMODE == 0) strcpy (CATMODE, "RAW");
  if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR");

  if (!LoadPhotcodes (PhotCodeFile)) {
    fprintf (stderr, "error loading photcodes\n");
    exit (0);
  }

}
