|
|
1.1 root 1: # include "stdio.h"
2: char *comname = "/usr/lib/eign";
3: static int cgate = 0;
4: extern char *comname;
5: # define COMNUM 500
6: # define COMTSIZE 997
7: int comcount = 100;
8: static char cbuf[COMNUM*9];
9: static char *cwds[COMTSIZE];
10: static char *cbp;
11:
12: common (s)
13: char *s;
14: {
15: if (cgate==0) cominit();
16: return (c_look(s, 1));
17: }
18: cominit()
19: {
20: int i;
21: FILE *f;
22: cgate=1;
23: f = fopen(comname, "r");
24: if (f==NULL) return;
25: cbp=cbuf;
26: for(i=0; i<comcount; i++)
27: {
28: if (fgets(cbp, 15, f)==NULL)
29: break;
30: trimnl(cbp);
31: c_look (cbp, 0);
32: while (*cbp++);
33: }
34: fclose(f);
35: }
36: c_look (s, fl)
37: char *s;
38: {
39: int h;
40: h = hash(s) % (COMTSIZE);
41: while (cwds[h] != 0)
42: {
43: if (strcmp(s, cwds[h])==0)
44: return(1);
45: h = (h+1) % (COMTSIZE);
46: }
47: if (fl==0)
48: cwds[h] = s;
49: return(0);
50: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.