-void read_file(const char *input_filename,
- int nb_fields_to_parse, struct parsable_field *fields_to_parse,
- FILE *db_file) {
- char raw_line[BUFFER_SIZE];
+void index_one_mbox_line(int nb_fields_to_parse, struct parsable_field *fields_to_parse,
+ char *raw_line, FILE *db_file) {
+ regmatch_t matches;
+ int f;
+ for(f = 0; f < nb_fields_to_parse; f++) {
+ if(regexec(&fields_to_parse[f].regexp, raw_line, 1, &matches, 0) == 0) {
+ fprintf(db_file, "%s %s\n",
+ fields_to_parse[f].name,
+ raw_line + matches.rm_eo);
+ }
+ }
+}
+
+void index_mbox(const char *input_filename,
+ int nb_fields_to_parse, struct parsable_field *fields_to_parse,
+ FILE *db_file) {
+ char raw_line[BUFFER_SIZE], full_line[BUFFER_SIZE];
+ char *end_of_full_line;