char * calloc(); char * todir();
char *sinput
, *soutput
, *tagout
;
long indexdate
=0, gdate();
/* read query from stdin, expect name of indexes in argv[1] */
static FILE *fa
, *fb
, *fc
;
char nma
[100], nmb
[100], nmc
[100], *qitem
[100], *rprog
= NULL
;
char nmd
[100], grepquery
[256];
static char oldname
[30] ;
/* these pointers are unions of pointer to int and pointer to long */
int falseflg
, nhash
, nitem
, nfound
, frtbl
, kk
;
/* special wart for refpart: default is tags only */
while (argv
[1][0] == '-')
case 'a': /* all output, incl. false drops */
case 'F': /* put out full text */
full
= setfrom(argv
[1][2]);
case 'T': /* put out tags */
tags
= setfrom(argv
[1][2]);
case 'i': /* input in argument string */
case 's': /*text output to string */
case 't': /*tag output to string */
case 'l': /* length of internal lists */
case 'g': /* suppress fgrep search on old files */
case 'C': /* coordination level */
colevel
= atoi(argv
[1]+2);
fprintf(stderr
, "colevel set to %d\n",colevel
);
case 'P': /* print term freqs */
strcpy (nma
, todir(argv
[1]));
if (was
== 0 || strcmp (oldname
, nma
) !=0)
strcpy (nmb
, nma
); strcpy (nmc
, nmb
); strcpy(nmd
,nma
);
{fclose(fa
); fclose(fb
); fclose(fc
);}
strcpy(*fgnamp
++ = calloc(strlen(oldname
)+2,1), oldname
);
if (fb
== NULL
|| fc
==NULL
)
err("Index incomplete %s", nmb
);
fread (&nhash
, sizeof(nhash
), 1, fa
);
fread (&iflong
, sizeof(iflong
), 1, fa
);
master
= calloc (lmaster
, iflong
? 4: 2);
hpt
= calloc(nhash
, sizeof(*hpt
));
kk
=fread( hpt
, sizeof(*hpt
), nhash
, fa
);
fprintf(stderr
,"read %d hashes, iflong %d, nhash %d\n", kk
, iflong
, nhash
);
hfreq
= calloc(nhash
, sizeof(*hfreq
));
frtbl
= fread(hfreq
, sizeof(*hfreq
), nhash
, fa
);
hfrflg
= (frtbl
== nhash
);
fprintf(stderr
, "read freqs %d\n", frtbl
);
nfound
= doquery(hpt
, nhash
, fb
, nitem
, qitem
, master
);
fprintf(stderr
,"after doquery nfound %d\n", nfound
);
nfound
= baddrop(master
, nfound
, fc
, nitem
, qitem
, rprog
, full
);
fprintf(stderr
,"after baddrop nfound %d\n", nfound
);
fprintf(stderr
, "were %d bad files\n", fgnamp
-fgnames
);
strcat(grepquery
, qitem
[k
]);
fprintf(stderr
, "grepquery %s\n",grepquery
);
for(fgp
=fgnames
; fgp
<fgnamp
; fgp
++)
fprintf(stderr
, "Now on %s query /%s/\n", *fgp
, grepquery
);
fprintf(stderr
, "grepmade\n");
grepcall(grepquery
, tagout
, *fgp
);
fprintf(stderr
, "tagout now /%s/\n", tagout
);
findline(tagout
, bout
, 1000);
result (master
, nfound
>tags
? tags
: nfound
, fc
);
while (s
>=t
&& *s
!= '/') s
--;
case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':