/* Global variables! */
-int quiet;
+int global_quiet;
-regex_t leading_from_line_regexp;
+regex_t global_leading_from_line_regexp;
/********************************************************************/
int is_a_leading_from_line(char *mbox_line) {
return
strncmp(mbox_line, "From ", 5) == 0 &&
- regexec(&leading_from_line_regexp, mbox_line, 0, 0, 0) == 0;
+ regexec(&global_leading_from_line_regexp, mbox_line, 0, 0, 0) == 0;
}
int mbox_line_match_search(struct search_condition *condition,
nb_extracted_mails = 0;
- if(!quiet) {
+ if(!global_quiet) {
printf("Searching in '%s' ... ", db_filename);
fflush(stdout);
}
fclose(db_file);
- if(!quiet) {
+ if(!global_quiet) {
printf("done.\n");
fflush(stdout);
}
unsigned int nb_search_conditions;
struct search_condition search_conditions[MAX_NB_SEARCH_CONDITIONS];
- if(regcomp(&leading_from_line_regexp, LEADING_FROM_LINE_REGEXP_STRING, 0)) {
+ if(regcomp(&global_leading_from_line_regexp, LEADING_FROM_LINE_REGEXP_STRING, 0)) {
fprintf(stderr,
"mymail: Cannot compile leading \"from\" line regexp. That is strange.\n");
exit(EXIT_FAILURE);
}
- quiet = 0;
+ global_quiet = 0;
default_search_field = 0;
strncpy(output_filename, "", PATH_MAX);
break;
case 'q':
- quiet = 1;
+ global_quiet = 1;
break;
case 'i':
output_file = safe_fopen(output_filename, "w", "result mbox");
} else {
output_file = stdout;
- quiet = 1;
+ global_quiet = 1;
}
if(nb_search_conditions > 0) {
}
}
- if(!quiet) {
+ if(!global_quiet) {
if(nb_extracted_mails > 0) {
printf("Found %d matching mails.\n", nb_extracted_mails);
} else {
free(db_filename_list);
free(mbox_filename_regexp_string);
- regfree(&leading_from_line_regexp);
+ regfree(&global_leading_from_line_regexp);
exit(EXIT_SUCCESS);
}