Cosmetics.
[mymail.git] / mymail.c
index b890b4b..ffc5621 100644 (file)
--- a/mymail.c
+++ b/mymail.c
@@ -101,6 +101,7 @@ struct search_condition {
 
 struct parsable_field {
   int id;
+  int cflags;
   char *regexp_string;
   regex_t regexp;
 };
@@ -108,31 +109,36 @@ struct parsable_field {
 static struct parsable_field fields_to_parse[] = {
   {
     ID_LEADING_LINE,
+    0,
     "^From ",
     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
   },
 
   {
     ID_FROM,
-    "^\\([Ff][Rr][Oo][Mm]:\\|[Rr][Ee][Pp][Ll][Yy]-[Tt][Oo]:\\|[Ss][Ee][Nn][Dd][Ee][Rr]:\\)",
+    REG_ICASE,
+    "^\\(from\\|reply-to\\|sender\\|return-path\\): ",
     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
   },
 
   {
     ID_TO,
-    "^\\([Tt][Oo]\\|[Cc][Cc]\\|[Bb][Cc][Cc]\\): ",
+    REG_ICASE,
+    "^\\(to\\|cc\\|bcc\\): ",
     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
   },
 
   {
     ID_SUBJECT,
-    "^[Ss][Uu][Bb][Jj][Ee][Cc][Tt]: ",
+    REG_ICASE,
+    "^subject: ",
     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
   },
 
   {
     ID_DATE,
-    "^[Dd][Aa][Tt][Ee]: ",
+    REG_ICASE,
+    "^date: ",
     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
   },
 
@@ -286,7 +292,9 @@ int mbox_line_match_search(struct search_condition *condition,
        (condition->field_id == ID_FROM && mbox_id == ID_LEADING_LINE)
 
        )
+
       &&
+
       regexec(&condition->regexp, mbox_value, 0, 0, 0) == 0;
   }
 }
@@ -1022,7 +1030,7 @@ int main(int argc, char **argv) {
     for(f = 0; f < nb_fields_to_parse; f++) {
       if(regcomp(&fields_to_parse[f].regexp,
                  fields_to_parse[f].regexp_string,
-                 REG_ICASE)) {
+                 fields_to_parse[f].cflags)) {
         fprintf(stderr,
                 "mymail: Syntax error in regexp \"%s\" for field \"%s\".\n",
                 fields_to_parse[f].regexp_string,