spellin.c
来自「操作系统SunOS 4.1.3版本的源码」· C语言 代码 · 共 45 行
C
45 行
#ifndef lintstatic char sccsid[] = "@(#)spellin.c 1.1 92/07/30; from UCB 4.1 82/12/18";#endif#include "spell.h"/* add entries to hash table for use by spell preexisting hash table is first argument words to be added are standard input if no hash table is given, create one from scratch*/main(argc,argv)char **argv;{ register i, j; long h; register long *lp; char word[NW]; register char *wp; if(!prime(argc,argv)) { fprintf(stderr, "spellin: cannot initialize hash table\n"); exit(1); } while (fgets(word, sizeof(word), stdin)) { for (i=0; i<NP; i++) { for (wp = word, h = 0, lp = pow2[i]; (j = *wp) != '\0'; ++wp, ++lp) h += j * *lp; h %= p[i]; set(h); } }#ifdef gcos freopen((char *)NULL, "wi", stdout);#endif if (fwrite((char *)tab, sizeof(*tab), TABSIZE, stdout) != TABSIZE) { fprintf(stderr, "spellin: trouble writing hash table\n"); exit(1); } return(0);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?