From: Francois Fleuret Date: Sat, 9 Mar 2013 09:41:09 +0000 (+0100) Subject: Cosmetics, renamed global variables global_*. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=5dc0d1c32d1e8c24188bccd30f7591819f79e750;p=mymail.git Cosmetics, renamed global variables global_*. --- diff --git a/mymail.c b/mymail.c index 50e5ba5..3d835a7 100644 --- a/mymail.c +++ b/mymail.c @@ -57,9 +57,9 @@ /* Global variables! */ -int quiet; +int global_quiet; -regex_t leading_from_line_regexp; +regex_t global_leading_from_line_regexp; /********************************************************************/ @@ -242,7 +242,7 @@ int ignore_entry(const char *name) { 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, @@ -373,7 +373,7 @@ int search_in_db(const char *db_filename, nb_extracted_mails = 0; - if(!quiet) { + if(!global_quiet) { printf("Searching in '%s' ... ", db_filename); fflush(stdout); } @@ -477,7 +477,7 @@ int search_in_db(const char *db_filename, fclose(db_file); - if(!quiet) { + if(!global_quiet) { printf("done.\n"); fflush(stdout); } @@ -839,13 +839,13 @@ int main(int argc, char **argv) { 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); @@ -867,7 +867,7 @@ int main(int argc, char **argv) { break; case 'q': - quiet = 1; + global_quiet = 1; break; case 'i': @@ -1039,7 +1039,7 @@ int main(int argc, char **argv) { output_file = safe_fopen(output_filename, "w", "result mbox"); } else { output_file = stdout; - quiet = 1; + global_quiet = 1; } if(nb_search_conditions > 0) { @@ -1091,7 +1091,7 @@ int main(int argc, char **argv) { } } - if(!quiet) { + if(!global_quiet) { if(nb_extracted_mails > 0) { printf("Found %d matching mails.\n", nb_extracted_mails); } else { @@ -1116,7 +1116,7 @@ int main(int argc, char **argv) { free(db_filename_list); free(mbox_filename_regexp_string); - regfree(&leading_from_line_regexp); + regfree(&global_leading_from_line_regexp); exit(EXIT_SUCCESS); }