projects
/
mymail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
68ba7a6
)
Changed the regexp for checking the leading From line.
author
Francois Fleuret
<francois@fleuret.org>
Sat, 23 Mar 2013 22:01:08 +0000
(23:01 +0100)
committer
Francois Fleuret
<francois@fleuret.org>
Sat, 23 Mar 2013 22:01:08 +0000
(23:01 +0100)
mymail.c
patch
|
blob
|
history
diff --git
a/mymail.c
b/mymail.c
index
b3f76d1
..
e6a2687
100644
(file)
--- a/
mymail.c
+++ b/
mymail.c
@@
-53,7
+53,7
@@
#define BUFFER_SIZE 65536
#define TOKEN_BUFFER_SIZE 1024
#define BUFFER_SIZE 65536
#define TOKEN_BUFFER_SIZE 1024
-#define LEADING_FROM_LINE_REGEXP_STRING "^From
[^ ]* \\(Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\) \\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|Sep\\|Oct\\|Nov\\|Dec\\) [
123][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]\n$"
+#define LEADING_FROM_LINE_REGEXP_STRING "^From
.*\\(Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\) \\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|Sep\\|Oct\\|Nov\\|Dec\\) [ 0
123][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]\n$"
/* Global variables! */
/* Global variables! */
@@
-154,12
+154,15
@@
int xor(int a, int b) {
const char *parse_token(char *token_buffer, size_t token_buffer_size,
char separator, const char *string) {
char *u = token_buffer;
const char *parse_token(char *token_buffer, size_t token_buffer_size,
char separator, const char *string) {
char *u = token_buffer;
+
while(*string == separator) { string++; }
while(*string == separator) { string++; }
- while(u < token_buffer + token_buffer_size - 1 && *string &&
-
*string != separator) {
+
+
while(u < token_buffer + token_buffer_size - 1 && *string &&
*string != separator) {
*(u++) = *(string++);
}
*(u++) = *(string++);
}
+
while(*string == separator) { string++; }
while(*string == separator) { string++; }
+
*u = '\0';
return string;
}
*u = '\0';
return string;
}
@@
-290,9
+293,6
@@
void update_body_hits(char *mail_filename, int position_in_mail,
if(fgets(raw_mbox_line, BUFFER_SIZE, mail_file)) {
while(nb_body_hits < nb_body_conditions) {
if(fgets(raw_mbox_line, BUFFER_SIZE, mail_file)) {
while(nb_body_hits < nb_body_conditions) {
- /* last_mbox_line_was_empty = (raw_mbox_line[0] == '\n'); */
- /* if(last_mbox_line_was_empty) { header = 0; } */
-
if(raw_mbox_line[0] == '\n') { header = 0; }
if(!header) {
if(raw_mbox_line[0] == '\n') { header = 0; }
if(!header) {
@@
-328,8
+328,7
@@
void extract_mail(const char *mail_filename, unsigned long int position_in_mail,
fprintf(output_file, "%s", raw_mbox_line);
while(1) {
if(!fgets(raw_mbox_line, BUFFER_SIZE, mail_file) ||
fprintf(output_file, "%s", raw_mbox_line);
while(1) {
if(!fgets(raw_mbox_line, BUFFER_SIZE, mail_file) ||
- (is_a_leading_from_line(raw_mbox_line))
- )
+ is_a_leading_from_line(raw_mbox_line))
break;
fprintf(output_file, "%s", raw_mbox_line);
}
break;
fprintf(output_file, "%s", raw_mbox_line);
}