⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msgcounts.c

📁 一个C语言写的快速贝叶斯垃圾邮件过滤工具
💻 C
字号:
/* $Id: msgcounts.c,v 1.31 2004/12/01 00:24:51 m-a Exp $ *//*****************************************************************************NAME:   msgcounts.c -- routines for setting & computing .MSG_COUNT valuesAUTHOR:   David Relson <relson@osagesoftware.com>******************************************************************************/#include "common.h"#include <stdlib.h>#include "msgcounts.h"/* Globals */static char	msg_count_buff[MSG_COUNT_MAX_LEN];int	msg_count_leng = MSG_COUNT_MAX_LEN; /* DO NOT MAKE THIS SIZE_T! */char   *msg_count_text = msg_count_buff;static const char *msg_count_header = "\"" MSG_COUNT "\" ";static size_t	    msg_count_header_len = 0;uint	msgs_good = 0;uint	msgs_bad  = 0;static	bool	saved = false;/* Function Definitions */token_t read_msg_count_line(void){    bool msg_sep;    if (!saved) {	if (fgets(msg_count_buff, sizeof(msg_count_buff), fpin) == NULL) {	    msg_count_leng = 0;	    return NONE;	}    }    msg_count_leng = strlen(msg_count_buff);    msg_sep = msg_count_buff[1] == '.' && 	memcmp(msg_count_buff, msg_count_header, msg_count_header_len) == 0;    if (!saved && msg_sep) {	saved = true;	return NONE;    }    else {	saved = false;	if (msg_sep)	    return MSG_COUNT_LINE;	else	    return BOGO_LEX_LINE;    }}bool msgcount_more(void){    bool val = saved;    saved = false;    return val;}void set_msg_counts(u_int32_t good, u_int32_t spam){    msgs_bad = spam;    msgs_good = good;}void set_msg_counts_from_str(char *str){    uint b, g;    b = atoi(str);    str = strchr(str, ' ') + 1;    g = atoi(str);    set_msg_counts(g, b);    msg_count_header_len= strlen(msg_count_header);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -