+
+static void r_pos_between (RSFD rfd, double *current, double *total)
+{
+ struct rset_between_rfd *p = (struct rset_between_rfd *) rfd;
+ struct rset_between_info *info = p->info;
+ double lcur,ltot;
+ double mcur,mtot;
+ double rcur,rtot;
+ double r;
+ ltot=-1; rtot=-1;
+ rset_pos(info->rset_l, p->rfd_l, &lcur, <ot);
+ rset_pos(info->rset_m, p->rfd_m, &mcur, &mtot);
+ rset_pos(info->rset_r, p->rfd_r, &rcur, &rtot);
+ if ( (ltot<0) && (mtot<0) && (rtot<0) ) { /*no position */
+ *current=mcur; /* return same as you got */
+ *total=mtot; /* probably -1 for not available */
+ }
+ if ( ltot<0) { ltot=0; lcur=0;} /* if only one useful, use it */
+ if ( mtot<0) { mtot=0; mcur=0;}
+ if ( rtot<0) { rtot=0; rcur=0;}
+ if ( ltot+mtot+rtot < 1 ) { /* empty rset */
+ *current=0;
+ *total=0;
+ return;
+ }
+ r=1.0*(lcur+mcur+rcur)/(ltot+mtot+rtot); /* weighed average of l and r */
+ *current=p->hits;
+ *total=*current/r ;
+#if RSBETWEEN_DEBUG
+ yaz_log(LOG_DEBUG,"betw_pos: (%s/%s) %0.1f/%0.1f= %0.4f ",
+ info->rset_l->control->desc, info->rset_r->control->desc,
+ *current, *total, r);
+#endif
+}