comparison src/readpst.c @ 246:5a82d41c883d

patches from Kenneth Berland for solaris
author Carl Byington <carl@five-ten-sg.com>
date Thu, 06 May 2010 15:28:46 -0700
parents 67b24d6a45d6
children 85d77d7b034b
comparison
equal deleted inserted replaced
245:9d3ceecb30d7 246:5a82d41c883d
869 return 0; 869 return 0;
870 } 870 }
871 871
872 872
873 int mk_separate_file(struct file_ll *f, char *extension) { 873 int mk_separate_file(struct file_ll *f, char *extension) {
874 const int name_offset = 1;
875 DEBUG_ENT("mk_separate_file"); 874 DEBUG_ENT("mk_separate_file");
876 DEBUG_INFO(("opening next file to save email\n")); 875 DEBUG_INFO(("opening next file to save email\n"));
877 if (f->item_count > 999999999) { // bigger than nine 9's 876 if (f->item_count > 999999999) { // bigger than nine 9's
878 DIE(("mk_separate_file: The number of emails in this folder has become too high to handle\n")); 877 DIE(("mk_separate_file: The number of emails in this folder has become too high to handle\n"));
879 } 878 }
880 sprintf(f->name, SEP_MAIL_FILE_TEMPLATE, f->item_count + name_offset, extension); 879 sprintf(f->name, SEP_MAIL_FILE_TEMPLATE, f->item_count, extension);
881 if (f->output) fclose(f->output); 880 if (f->output) fclose(f->output);
882 f->output = NULL; 881 f->output = NULL;
883 check_filename(f->name); 882 check_filename(f->name);
884 if (!(f->output = fopen(f->name, "w"))) { 883 if (!(f->output = fopen(f->name, "w"))) {
885 DIE(("mk_separate_file: Cannot open file to save email \"%s\"\n", f->name)); 884 DIE(("mk_separate_file: Cannot open file to save email \"%s\"\n", f->name));
1445 } 1444 }
1446 1445
1447 // create required header fields that are not already written 1446 // create required header fields that are not already written
1448 1447
1449 if (!has_from) { 1448 if (!has_from) {
1450 fprintf(f_output, "From: \"%s\" <%s>\n", item->email->outlook_sender_name.str, sender); 1449 if (item->email->outlook_sender_name.str){
1450 fprintf(f_output, "From: \"%s\" <%s>\n", item->email->outlook_sender_name.str, sender);
1451 } else {
1452 fprintf(f_output, "From: <%s>\n", sender);
1453 }
1451 } 1454 }
1452 1455
1453 if (!has_subject) { 1456 if (!has_subject) {
1454 if (item->subject.str) { 1457 if (item->subject.str) {
1455 fprintf(f_output, "Subject: %s\n", item->subject.str); 1458 fprintf(f_output, "Subject: %s\n", item->subject.str);