debug.main.c

来自「一个C语言写的快速贝叶斯垃圾邮件过滤工具」· C语言 代码 · 共 48 行

C
48
字号
/* $Id: debug.main.c,v 1.4 2003/10/29 18:51:23 relson Exp $ *//*****************************************************************************NAME:   debug.main.c - shared debug functionsAUTHOR:   David Relson <relson@osagesoftware.com>******************************************************************************/#include "common.h"#include <stdlib.h>#include <string.h>typedef struct mask_char_to_symbol_s {    const char *str;    u_int32_t bit;}  mask_char_to_symbol_t;static mask_char_to_symbol_t const char_to_symbol[] ={    { "g",	BIT_GENERAL },    { "s",	BIT_SPAMICITY },    { "d",	BIT_DATABASE },    { "l",	BIT_LEXER },    { "w",	BIT_WORDLIST }};int main(void){    size_t i;    for (i=0; i<sizeof(char_to_symbol)/sizeof(char_to_symbol[0]); i += 1)    {	const mask_char_to_symbol_t *ptr = char_to_symbol + i;	set_debug_mask( ptr->str );	if ( (debug_mask & ptr->bit) != ptr->bit )	{	    fprintf(stderr, "debug_mask for '%s' is wrong.\n", ptr->str);	    exit(EX_ERROR);	}    }    printf("All O.K.\n");    return 0;}

⌨️ 快捷键说明

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