newkeys (outf
, inf
, recf
, nhash
, fd
, iflong
)
FILE *outf
, *inf
, *recf
, *fd
;
/* reads key lines from inf; hashes and writes on outf; writes orig
key on recf, records pointer on outf too.
format of outf is : hash code space record pointer
long ld
0; int ll
0, lt
0;
int i
, nk
, ndoc
0, more
0, c
;
while (fgets(line
, LINESIZ
, inf
))
sprintf(bkeys
, ";%ld", ld
);
sprintf(bkeys
, ",%d", ll
);
_assert (fd
==0 || more
==0);
fprintf(outf
,"%04d %06ld\n",hash(keyv
[i
])%nhash
, lp
);
printf("key %s hash %d\n",keyv
[i
],hash(keyv
[i
])%nhash
);
if (more
) /* allow more than LINESIZ keys */
while ( (c
=getc(inf
)) != '\n')
fprintf(outf
, "%04d %06ld\n",hash(key
)%nhash
, lp
);
lp
+= (strlen(line
)+lt
+1);