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

Defined functions

c_look defined in line 42; used 2 times
cominit defined in line 23; used 1 times
  • in line 19

Defined variables

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

Defined macros

COMNUM defined in line 6; used 1 times
  • in line 12
COMTSIZE defined in line 7; used 3 times
Last modified: 1996-10-24
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2404
Valid CSS Valid XHTML 1.0 Strict