# 2.11BSD#431 - /usr/src/usr.bin/refer/mkey3.c

##### Functions

    c_look            X
    cominit           X
    common            X

##### Variables

    comcount          X
    comname           X

##### Macros

    COMNUM            X
    COMTSIZE          X

       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

- in line 20, 36

cominit defined in line 23; used 1 times

- in line 19

common defined in line 16; used 5 times

- in /usr/src/usr.bin/refer/flagger.c line 49-50(2)
- in /usr/src/usr.bin/refer/mkey2.c line 67
- in /usr/src/usr.bin/refer/refer2.c line 63
- in /usr/src/usr.bin/refer/what4.c line 44

#### Defined variables

cbp defined in line 14; used 5 times

- in line 30-37(5)

cbuf defined in line 12; used 1 times

- in line 30

cgate defined in line 10; used 2 times

- in line 19, 27

comcount defined in line 11; used 3 times

- in line 31
- in /usr/src/usr.bin/refer/flagger.c line 30
- in /usr/src/usr.bin/refer/mkey1.c line 59

comname defined in line 9; used 2 times

- in line 28
- in /usr/src/usr.bin/refer/mkey1.c line 37

cwds defined in line 13; used 3 times

- in line 47-54(3)

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

- in line 13, 46-51(2)

Last modified: 1996-10-24 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 511 |