1: #ifndef lint
   2: static char *sccsid = "@(#)inv5.c	4.2 (Berkeley) 1/9/85";
   3: #endif
   4: 
   5: #include <stdio.h>
   6: 
   7: recopy (ft, fb, fa, nhash)
   8: FILE *ft, *fb, *fa;
   9: {
  10:     /* copy fb (old hash items/pointers) to ft (new ones) */
  11:     int n, i, iflong;
  12:     long getl();
  13:     int getw();
  14:     int *hpt_s;
  15:     int (*getfun)();
  16:     long *hpt_l;
  17:     long k, lp;
  18:     if (fa==NULL)
  19:     {
  20:         err("No old pointers",0);
  21:         return;
  22:     }
  23:     fread(&n, sizeof(n), 1, fa);
  24:     fread(&iflong, sizeof(iflong), 1, fa);
  25:     if (iflong)
  26:     {
  27:         hpt_l = (long *) calloc(sizeof(*hpt_l), n+1);
  28:         n =fread(hpt_l, sizeof(*hpt_l), n, fa);
  29:     }
  30:     else
  31:     {
  32:         hpt_s =  (int *) calloc(sizeof(*hpt_s), n+1);
  33:         n =fread(hpt_s, sizeof(*hpt_s), n, fa);
  34:     }
  35:     if (n!= nhash)
  36:         fprintf(stderr, "Changing hash value to old %d\n",n);
  37:     fclose(fa);
  38:     if (iflong)
  39:         getfun = getl;
  40:     else
  41:         getfun = getw;
  42:     for(i=0; i<n; i++)
  43:     {
  44:         if (iflong)
  45:             lp = hpt_l[i];
  46:         else
  47:             lp = hpt_s[i];
  48:         fseek(fb, lp, 0);
  49:         while ( (k= (*getfun)(fb) ) != -1)
  50:             fprintf(ft, "%04d %06ld\n",i,k);
  51:     }
  52:     fclose(fb);
  53:     return(n);
  54: }

Defined functions

recopy defined in line 7; never used

Defined variables

sccsid defined in line 2; never used
Last modified: 1987-02-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2267
Valid CSS Valid XHTML 1.0 Strict