# 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].Nm; i++) {
    if (measure[i].source != star[0].code) continue;
    measure[i].dR_PS       = 3600.0*(average[0].R - star[0].R);
    measure[i].dD_PS       = 3600.0*(average[0].D - star[0].D);
    measure[i].M_PS        = MIN (star[0].M,  NO_MAG);
    measure[i].dM_PS       = MIN (star[0].dM, NO_ERR);
    star[0].found          = average[0].offset + i;
    return (TRUE);
  }
  return (FALSE);
}
