# include "inv.h"
int recopy(FILE *ft, FILE *fb, FILE *fa, int nhash)
{
/* copy fb (old hash items/pointers) to ft (new ones) */
int i, n;
long k;
Index ind;
if (fa == NULL) {
err("No old pointers");
return 0;
}
initindex(&ind);
n = getindex(&ind, fa);
fclose(fa);
if (n != nhash)
fprintf(stderr, "Changing hash value to old %d\n", n);
for (i = 0; i < n; i++) {
fseek(fb, ind.hash.el[i], 0);
while ((k = getl(fb)) != -1)
fprintf(ft, "%.5d %.9ld\n", i, k);
}
emptyindex(&ind);
fclose(fb);
return n;
}
|