# include "relphot.h"

static FITS_DB *db = NULL;

void set_db (FITS_DB *in) {
  db = in;
}

/* clean up open / locked ImageCat before shutting down */
int Shutdown (char *format, ...) {  
  va_list argp;
  char *formatplus;
  
  ALLOCATE (formatplus, char, strlen(format));
  strcpy (formatplus, format);
  strcat (formatplus, "\n");

  va_start (argp, format);
  vfprintf (stderr, formatplus, argp);
  free (formatplus);
  va_end (argp);

  SetProtect (TRUE);
  if (db) gfits_db_close (db);
  fprintf (stderr, "ERROR: addstar halted\n");
  exit (1);
}

