File: mls.h

package info (click to toggle)
mailliststat 1.3-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 260 kB
  • ctags: 261
  • sloc: ansic: 1,888; php: 110; makefile: 81; sh: 24
file content (126 lines) | stat: -rw-r--r-- 3,491 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/****************************************************************************
    MailListStat - print useful statistics on email messages
    main header file
    Copyright (C) 2001-2003  Marek Podmaka <marki@nexin.sk>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ****************************************************************************/

#ifndef	_MLS_H
#define	_MLS_H	1

#define VERSION "1.3"

#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <time.h>
#include <regex.h>
#include <math.h>
#include <sys/time.h>
#include <sys/resource.h>

// maximum no. of substrings to match in regex
#define MAX_REGMATCH 7
// length of input buffer for reading mbox file
#define MAX_LINE 800
// maximum length of remembered subject
#define MAX_SUBJ 160
// maximum length of remembered author (email)
#define MAX_AUTH 160
// maximum length of remembered date
#define MAX_DATE 40
// TEXT will have min/max of AUTH and SUBJ
#if MAX_AUTH > MAX_SUBJ
#define MAX_TEXT MAX_AUTH
#define MIN_TEXT MAX_SUBJ
#else
#define MAX_TEXT MAX_SUBJ
#define MIN_TEXT MAX_AUTH
#endif

// for bit-mapped files variable (last 3 are for cache)
#define F_INPUT   2
#define F_OUTPUT  4
#define F_READ    8
#define F_WRITE  16
#define F_UPDATE 32

// for bit-mapped graph variable - what graphs to show
#define G_DAY    2
#define G_WEEK   4
#define G_MONTH  8
#define G_YEAR  16

// for myWarn - exit error codes
#define EXIT_NOERR  0
#define EXIT_CACHE  1
#define EXIT_PARAM  2
#define EXIT_FILEIO 3
#define EXIT_NOMEM  4
#define EXIT_REGEX  5

/* *** structures for BEST messages *** */
typedef struct bestQUOTE* nQptr;
struct bestQUOTE {
   char auth[MAX_AUTH];
   char subj[MAX_SUBJ];
   char date[MAX_DATE];
   long size;
   float perc;
};

typedef struct bestDLZKA* nDptr;
struct bestDLZKA {
   char auth[MAX_AUTH];
   char subj[MAX_SUBJ];
   char date[MAX_DATE];
   long size;
};

// structures w/ pointers to next in list - for best SUBJ & AUTH
typedef struct bestTEXT* nTptr;
struct bestTEXT {
   char text[MAX_TEXT];
   long size;
   long quote;
   long count;
   nTptr next;
};

// Reg. expressions
regex_t r_from, r_time, r_re, r_date, r_dow, r_mail,
        r_m_ims, r_m_bat, r_m_lot, r_m_oue, r_m_ouc, r_m_oum, r_m_out,
	r_m_cal, r_m_moz, r_m_peg, r_m_eud, r_m_ope, r_m_opw, r_m_pos,
	r_m_pob, r_m_kma, r_m_imp, r_m_mut, r_m_pin, r_m_pi2, r_m_syl,
	r_m_pan, r_m_4td, r_m_fag, r_m_mpg, r_m_xws, r_m_knd, r_m_hst,
	r_m_nnr;

/* ********************************************* FUNCTION DECLARATIONS *** */
void banner();
void help(char *);
void myWarn(char *, char *, int);
void myVerb(char *, char *);
void compile_mls_regex();
nTptr ReadZoz(FILE *);
void ReadCacheFile(char *, int);
void WriteCacheFile(char *);
void WriteZoz(FILE *, nTptr);


#endif /* mls.h */