112295Stut #ifndef lint 2*34097Sbostic static char *sccsid = "@(#)inv5.c 4.3 (Berkeley) 04/24/88"; 312295Stut #endif 412295Stut 512295Stut #include <stdio.h> 612295Stut 712295Stut recopy (ft, fb, fa, nhash) 812295Stut FILE *ft, *fb, *fa; 912295Stut { 1012295Stut /* copy fb (old hash items/pointers) to ft (new ones) */ 1112295Stut int n, i, iflong; 1212295Stut long getl(); 1312295Stut int getw(); 1412295Stut int *hpt_s; 1512295Stut long *hpt_l; 1612295Stut long k, lp; 1712295Stut if (fa==NULL) 1812295Stut { 1912295Stut err("No old pointers",0); 2012295Stut return; 2112295Stut } 2212295Stut fread(&n, sizeof(n), 1, fa); 2312295Stut fread(&iflong, sizeof(iflong), 1, fa); 2412295Stut if (iflong) 2512295Stut { 2617679Sralph hpt_l = (long *) calloc(sizeof(*hpt_l), n+1); 2712295Stut n =fread(hpt_l, sizeof(*hpt_l), n, fa); 2812295Stut } 2912295Stut else 3012295Stut { 3117679Sralph hpt_s = (int *) calloc(sizeof(*hpt_s), n+1); 3212295Stut n =fread(hpt_s, sizeof(*hpt_s), n, fa); 3312295Stut } 3412295Stut if (n!= nhash) 3512295Stut fprintf(stderr, "Changing hash value to old %d\n",n); 3612295Stut fclose(fa); 3712295Stut for(i=0; i<n; i++) 3812295Stut { 39*34097Sbostic if (iflong) { 4012295Stut lp = hpt_l[i]; 41*34097Sbostic fseek(fb, lp, 0); 42*34097Sbostic while ( (k= getl(fb) ) != -1) 43*34097Sbostic fprintf(ft, "%04d %06ld\n",i,k); 44*34097Sbostic } else { 4512295Stut lp = hpt_s[i]; 46*34097Sbostic fseek(fb, lp, 0); 47*34097Sbostic while ( (k= getw(fb) ) != -1) 48*34097Sbostic fprintf(ft, "%04d %06ld\n",i,k); 49*34097Sbostic } 5012295Stut } 5112295Stut fclose(fb); 5212295Stut return(n); 5312295Stut } 54