# include "addstar.h"

int replace_match (Average *average, Measure *measure, Stars *star) {

  int i;

  /* search for entry and replace values M, dM, R, D */
  for (i = 0; i < average[0].Nmeasure; i++) {
    if (measure[i].photcode != star[0].measure.photcode) continue;
    measure[i].dR = 3600.0*(average[0].R - star[0].average.R);
    measure[i].dD = 3600.0*(average[0].D - star[0].average.D);
    measure[i].M  = star[0].measure.M;
    measure[i].dM = star[0].measure.dM;
    star[0].found = average[0].measureOffset + i;
    return (TRUE);
  }
  return (FALSE);
}
