1: #ifndef lint
   2: static char *sccsid = "@(#)mkey3.c	4.1 (Berkeley) 5/6/83";
   3: #endif
   4: 
   5: #include <stdio.h>
   6: #define COMNUM 500
   7: #define COMTSIZE 997
   8: 
   9: char *comname = "/usr/lib/eign";
  10: static int cgate = 0;
  11: extern char *comname;
  12: int comcount = 100;
  13: static char cbuf[COMNUM*9];
  14: static char *cwds[COMTSIZE];
  15: static char *cbp;
  16: 
  17: common (s)
  18: char *s;
  19: {
  20:     if (cgate==0) cominit();
  21:     return (c_look(s, 1));
  22: }
  23: 
  24: cominit()
  25: {
  26:     int i;
  27:     FILE *f;
  28:     cgate=1;
  29:     f = fopen(comname, "r");
  30:     if (f==NULL) return;
  31:     cbp=cbuf;
  32:     for(i=0; i<comcount; i++)
  33:     {
  34:         if (fgets(cbp, 15, f)==NULL)
  35:             break;
  36:         trimnl(cbp);
  37:         c_look (cbp, 0);
  38:         while (*cbp++);
  39:     }
  40:     fclose(f);
  41: }
  42: 
  43: c_look (s, fl)
  44: char *s;
  45: {
  46:     int h;
  47:     h = hash(s) % (COMTSIZE);
  48:     while (cwds[h] != 0)
  49:     {
  50:         if (strcmp(s, cwds[h])==0)
  51:             return(1);
  52:         h = (h+1) % (COMTSIZE);
  53:     }
  54:     if (fl==0)
  55:         cwds[h] = s;
  56:     return(0);
  57: }

Defined functions

c_look defined in line 43; used 2 times
cominit defined in line 24; used 1 times
  • in line 20

Defined variables

cbp defined in line 15; used 5 times
cbuf defined in line 13; used 1 times
  • in line 31
cgate defined in line 10; used 2 times
comcount defined in line 12; used 3 times
comname declared in line 11; defined in line 9; used 2 times
cwds defined in line 14; used 3 times
sccsid defined in line 2; never used

Defined macros

COMNUM defined in line 6; used 1 times
  • in line 13
COMTSIZE defined in line 7; used 3 times
Last modified: 1983-05-08
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1066
Valid CSS Valid XHTML 1.0 Strict