1 #ifndef GLOBALS_H 2 #define GLOBALS_H 3 4 #include <float.h> /* has DBL_EPSILON */ 5 #define EPS DBL_EPSILON /* equality cutoff */ 6 7 #include "system.h" /* has bool */ 8 #include "common.h" /* has PATH_LEN */ 9 10 #include <sys/types.h> 11 #include "bftypes.h" 12 13 #ifdef __LCLINT__ 14 typedef int bool; 15 #endif 16 17 extern bool fBogotune; 18 extern bool fBogoutil; 19 extern bool fBogofilter; 20 21 /* for transactions */ 22 extern e_txn eTransaction; 23 24 /* command line options */ 25 extern bulk_t bulk_mode; /* '-B' */ 26 extern bool suppress_config_file; /* '-C' */ 27 extern bool nonspam_exits_zero; /* '-e' */ 28 extern bool fisher; /* '-f' */ 29 extern FILE *fpin; /* '-I' */ 30 extern bool logflag; /* '-l' */ 31 32 extern uint min_token_len; 33 extern uint max_token_len; 34 extern uint max_multi_token_len; 35 extern uint multi_token_count; 36 37 extern bool mbox_mode; /* '-M' */ 38 extern char outfname[PATH_LEN]; /* '-O' */ 39 extern bool passthrough; /* '-p' */ 40 extern bool pairs; /* '-P' */ 41 extern bool quiet; /* '-q' */ 42 extern int query; /* '-Q' */ 43 extern bool Rtable; /* '-R' */ 44 extern bool terse; /* '-t' */ 45 extern int bogotest; /* '-X', env("BOGOTEST") */ 46 extern int verbose; /* '-v' */ 47 extern bool replace_nonascii_characters; /* '-n' */ 48 49 /* config file options */ 50 extern double min_dev; 51 extern double ham_cutoff; 52 extern double spam_cutoff; 53 extern double thresh_update; 54 55 extern uint token_count_fix; 56 extern uint token_count_min; 57 extern uint token_count_max; 58 59 extern int abort_on_error; 60 extern bool stats_in_header; 61 62 extern bool header_line_markup; /* -Ph,-PH */ 63 64 extern const char *update_dir; 65 extern const char *progname; 66 extern char *progtype; 67 /*@observer@*/ 68 extern const char *stats_prefix; 69 extern const char *const version; 70 extern const char *const system_config_file; 71 72 /* for msgcounts.c */ 73 #define MSG_COUNT ".MSG_COUNT" 74 extern uint msgs_good; 75 extern uint msgs_bad; 76 77 /* for passthrough.c */ 78 extern size_t msg_register_size; 79 extern char msg_register[256]; 80 81 /* old new 82 ** robs 0.010 0.0178 83 ** robx 0.415 0.52 84 ** min_dev 0.1 0.375 85 ** spam_cutoff 0.95 0.99 86 ** ham_cutoff 0.00 0.00 (bi-state) 87 ** ham_cutoff 0.10 0.45 (tri-state) 88 */ 89 90 #define ROBS 0.0178 /* Robinson's s */ 91 #define ROBX 0.52 /* Robinson's x */ 92 #define MIN_DEV 0.375 93 94 #define SP_ESF 1.0 95 #define NS_ESF 1.0 96 97 #define HAM_CUTOFF 0.45 /* 0.45 for three-state, 0.00 for two-state */ 98 #define SPAM_CUTOFF 0.99 99 100 #define ROBX_W ".ROBX" 101 102 extern double robs; 103 extern double robx; 104 extern double sp_esf; 105 extern double ns_esf; 106 107 /* for BerkeleyDB */ 108 #define DB_CACHESIZE 4 /* in MB */ 109 extern uint db_cachesize; 110 111 /* other */ 112 113 extern FILE *fpo; 114 115 extern bool msg_count_file; 116 extern bool unsure_stats; /* true if print stats for unsures */ 117 118 #define WORDLIST_VERSION ".WORDLIST_VERSION" 119 extern uint wordlist_version; 120 121 #define WORDLIST_ENCODING ".ENCODING" 122 extern e_enc encoding; 123 124 #ifndef HAVE_SIG_ATOMIC_T 125 typedef volatile int sig_atomic_t; 126 #endif 127 128 extern sig_atomic_t fDie; /* true if a terminating signal (such as 129 SIGINT or SIGTERM) has been received */ 130 131 void init_globals(void); /**< initialize all global variables */ 132 133 extern char *spam_header_name; 134 extern char *spam_header_place; 135 136 #endif 137