1: #ifndef lint
   2: static char sccsid[] = "@(#)spellin.c	4.1 12/18/82";
   3: #endif
   4: 
   5: #include "spell.h"
   6: /* add entries to hash table for use by spell
   7:    preexisting hash table is first argument
   8:    words to be added are standard input
   9:    if no hash table is given, create one from scratch
  10: */
  11: 
  12: main(argc,argv)
  13: char **argv;
  14: {
  15:     register i, j;
  16:     long h;
  17:     register long *lp;
  18:     char word[NW];
  19:     register char *wp;
  20: 
  21:     if(!prime(argc,argv)) {
  22:         fprintf(stderr,
  23:             "spellin: cannot initialize hash table\n");
  24:         exit(1);
  25:     }
  26:     while (fgets(word, sizeof(word), stdin)) {
  27:         for (i=0; i<NP; i++) {
  28:             for (wp = word, h = 0, lp = pow2[i];
  29:                  (j = *wp) != '\0'; ++wp, ++lp)
  30:                 h += j * *lp;
  31:             h %= p[i];
  32:             set(h);
  33:         }
  34:     }
  35: #ifdef gcos
  36:     freopen((char *)NULL, "wi", stdout);
  37: #endif
  38:     if (fwrite((char *)tab, sizeof(*tab), TABSIZE, stdout) != TABSIZE) {
  39:         fprintf(stderr,
  40:             "spellin: trouble writing hash table\n");
  41:         exit(1);
  42:     }
  43:     return(0);
  44: }

Defined functions

main defined in line 12; never used

Defined variables

sccsid defined in line 2; never used
Last modified: 1987-03-15
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2532
Valid CSS Valid XHTML 1.0 Strict