# include "delstar.h"

wcatalog (Catalog *catalog) {
  
  int status;

  /* we'll leave these for now, but they are LONEOS specific */
  fits_modify (&catalog[0].header, "MARKSTAR", "%t", 1, FALSE);
  fits_modify (&catalog[0].header, "ADDUSNO", "%t", 1, FALSE);
  fits_modify (&catalog[0].header, "MARKROCK", "%t", 1, FALSE);

  if (!save_catalog (catalog, VERBOSE)) {
    fprintf (stderr, "ERROR: failure saving catalog\n");
    exit (1);
  }

  /* free, initialize data structures */

  if (catalog[0].Naverage) {
    free (catalog[0].average); 
    catalog[0].Naverage = 0;
  }
  if (catalog[0].Nmeasure) {
    free (catalog[0].measure); 
    catalog[0].Nmeasure = 0;
  }
  if (catalog[0].Nmissing) {
    free (catalog[0].missing); 
    catalog[0].Nmissing = 0;
  }
  if (catalog[0].Nsecfilt) {
    free (catalog[0].secfilt); 
    catalog[0].Nsecfilt = 0;
  }
  fits_free_header (&catalog[0].header);
}

