int main(int argc, char *argv[]) { FILE *fp_strpool; FILE *fp_checkedmail; FILE *fp_result; FILE *fp_strpooled; if(argc<2) { fprintf(stderr, "ERROR: No word file specified\n"); return -1; } fp_strpool = fopen(argv[1],"r"); fp_checkedmail = fopen(argv[2],"r"); fp_result = fopen(argv[3],"w"); printf("Now we will init the strpool.dat........\n"); init(argv); printf("The init done........\n"); fp_strpooled = fopen("strpooled.dat","r"); printf("We will build the trie and match the strings\n"); trie_check(fp_strpooled,fp_checkedmail,fp_result); printf("The trie match done!\n"); printf("Next is Bloom Filter Match.......\n"); fseek(fp_strpooled, 0, SEEK_SET); fseek(fp_checkedmail, 0, SEEK_SET); bf_check(fp_strpooled,fp_checkedmail,fp_result); return 0; }
const char *CmdCheckHandler(bloom_filter_t *bloom, const char element[]) { return bf_check(bloom, element) ? hit_response : miss_response; }