X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=mymail.c;h=a29fedbd24855124bb8b4f3e1af2617d312f6fe7;hb=9385a49c7a296bdaf163a280d68173a896f11f78;hp=e6a268710777a44d0a28b7bf123b2d626dde155a;hpb=21e7610626308bc90e09e71d7c845e83133b7aad;p=mymail.git diff --git a/mymail.c b/mymail.c index e6a2687..a29fedb 100644 --- a/mymail.c +++ b/mymail.c @@ -46,7 +46,9 @@ #include #define MYMAIL_DB_MAGIC_TOKEN "mymail_index_file" -#define VERSION "0.9.6" +#define MYMAIL_VERSION "0.9.8" + +#define MYMAIL_DB_FORMAT_VERSION 1 #define MAX_NB_SEARCH_CONDITIONS 32 @@ -199,7 +201,7 @@ FILE *safe_fopen(const char *path, const char *mode, const char *comment) { /*********************************************************************/ void print_version(FILE *out) { - fprintf(out, "mymail version %s (%s)\n", VERSION, UNAME); + fprintf(out, "mymail version %s (%s)\n", MYMAIL_VERSION, UNAME); } void print_usage(FILE *out) { @@ -321,6 +323,8 @@ void extract_mail(const char *mail_filename, unsigned long int position_in_mail, char raw_mbox_line[BUFFER_SIZE]; FILE *mail_file; + /* printf("Extract\n"); */ + mail_file = safe_fopen(mail_filename, "r", "mbox for mail extraction"); fseek(mail_file, position_in_mail, SEEK_SET); @@ -395,6 +399,7 @@ void update_time(int db_key, const char *db_value, time_t *t) { if(db_key == ID_LEADING_LINE) { c = db_value; while(*c && *c != ' ') c++; while(*c && *c == ' ') c++; + /* printf("From %s", db_value); */ strptime(c, "%a %b %e %k:%M:%S %Y", &tm); *t = mktime(&tm); } else { @@ -402,6 +407,7 @@ void update_time(int db_key, const char *db_value, time_t *t) { if(db_key == ID_DATE) { if(strptime(db_value, "%a, %d %b %Y %k:%M:%S", &tm) || strptime(db_value, "%d %b %Y %k:%M:%S", &tm)) { + /* printf("Date: %s", db_value); */ *t = mktime(&tm); } } @@ -826,6 +832,7 @@ void init_condition(struct search_condition *condition, const char *full_string, condition->time_stop = 0; } } + break; } } @@ -1074,7 +1081,7 @@ int main(int argc, char **argv) { } } - fprintf(db_file, "%s version_%s raw\n", MYMAIL_DB_MAGIC_TOKEN, VERSION); + fprintf(db_file, "%s version_%s format_%d raw\n", MYMAIL_DB_MAGIC_TOKEN, MYMAIL_VERSION, MYMAIL_DB_FORMAT_VERSION); while(optind < argc) { recursive_index_mbox(db_file,