# include <signal.h>

struct {
  int Ntimes;         unsigned long *tstart, *tstop;
  int PhotCodeSelect; int photcode;
  int LabelSelect;    char *Label;
} criteria;

struct {
  int delete;
  int modify;

  int HST;
  int verbose;
  int convert;
  char *table;
  char *bintable;
  char *cadctable;

  int equiv;
  int offset;
  char *db;
} output;

enum {UNLOCK, LOCK, IGNORE};

int args (int argc, char **argv);
int regargs (int argc, char **argv, PhotPars *);
PhotPars *get_images (int *N);
int set_images (PhotPars *new, int Nnew);
int load_db ();
int save_db ();
int update_db (int *match, int Nmatch);
int append_db (PhotPars *new, int Nnew);
int create_db ();
int close_db ();
void DeleteSubset (int *match, int Nmatch);
int *match_criteria (int *Nmatch);
int *match_images (PhotPars *subset, int Nsubset, int *Nmatch);
void ModifySubset (int *match, int Nmatch);
void OutputSubset (int *match, int Nmatch);
void DumpFitsBintable (char *filename, PhotPars *image, int *match, int Nmatch);
void DumpFitsTable (char *filename, PhotPars *image, int *match, int Nmatch);
int PrintSubset (PhotPars *image, int *match, int Nmatch);
int define_table (Header *header, Matrix *matrix, Header *theader, FTable *table);
void set_timezone (double dt);
void DumpCADCTable (char *filename, PhotPars *image, int *match, int Nmatch);
