Mercurial > libpst
comparison src/readpst.c @ 298:201464dd356e
add default character set for items where the pst file does not specify a character set
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 02 Aug 2011 17:02:39 -0700 |
parents | 8b3a827b71f4 |
children | 47abe56076da |
comparison
equal
deleted
inserted
replaced
297:8b3a827b71f4 | 298:201464dd356e |
---|---|
131 int overwrite = 0; | 131 int overwrite = 0; |
132 int save_rtf_body = 1; | 132 int save_rtf_body = 1; |
133 int file_name_len = 10; // enough room for MODE_SPEARATE file name | 133 int file_name_len = 10; // enough room for MODE_SPEARATE file name |
134 pst_file pstfile; | 134 pst_file pstfile; |
135 regex_t meta_charset_pattern; | 135 regex_t meta_charset_pattern; |
136 char* default_charset = NULL; | |
136 | 137 |
137 int number_processors = 1; // number of cpus we have | 138 int number_processors = 1; // number of cpus we have |
138 int max_children = 0; // based on number of cpus and command line args | 139 int max_children = 0; // based on number of cpus and command line args |
139 int max_child_specified = 0;// have command line arg -j | 140 int max_child_specified = 0;// have command line arg -j |
140 int active_children; // number of children of this process, cannot be larger than max_children | 141 int active_children; // number of children of this process, cannot be larger than max_children |
441 printf("cannot compile regex pattern to find content charset in html bodies\n"); | 442 printf("cannot compile regex pattern to find content charset in html bodies\n"); |
442 exit(3); | 443 exit(3); |
443 } | 444 } |
444 | 445 |
445 // command-line option handling | 446 // command-line option handling |
446 while ((c = getopt(argc, argv, "bc:Dd:ehj:kMo:qrSt:uVw"))!= -1) { | 447 while ((c = getopt(argc, argv, "bC:c:Dd:ehj:kMo:qrSt:uVw"))!= -1) { |
447 switch (c) { | 448 switch (c) { |
448 case 'b': | 449 case 'b': |
449 save_rtf_body = 0; | 450 save_rtf_body = 0; |
451 break; | |
452 case 'C': | |
453 if (optarg) { | |
454 default_charset = optarg; | |
455 } | |
456 else { | |
457 usage(); | |
458 exit(0); | |
459 } | |
450 break; | 460 break; |
451 case 'c': | 461 case 'c': |
452 if (optarg && optarg[0]=='v') { | 462 if (optarg && optarg[0]=='v') { |
453 contact_mode=CMODE_VCARD; | 463 contact_mode=CMODE_VCARD; |
454 contact_mode_specified = 1; | 464 contact_mode_specified = 1; |
595 #endif | 605 #endif |
596 DEBUG_ENT("main"); | 606 DEBUG_ENT("main"); |
597 | 607 |
598 if (output_mode != OUTPUT_QUIET) printf("Opening PST file and indexes...\n"); | 608 if (output_mode != OUTPUT_QUIET) printf("Opening PST file and indexes...\n"); |
599 | 609 |
600 RET_DERROR(pst_open(&pstfile, fname), 1, ("Error opening File\n")); | 610 RET_DERROR(pst_open(&pstfile, fname, default_charset), 1, ("Error opening File\n")); |
601 RET_DERROR(pst_load_index(&pstfile), 2, ("Index Error\n")); | 611 RET_DERROR(pst_load_index(&pstfile), 2, ("Index Error\n")); |
602 | 612 |
603 pst_load_extended_attributes(&pstfile); | 613 pst_load_extended_attributes(&pstfile); |
604 | 614 |
605 if (chdir(output_dir)) { | 615 if (chdir(output_dir)) { |
697 DEBUG_ENT("usage"); | 707 DEBUG_ENT("usage"); |
698 version(); | 708 version(); |
699 printf("Usage: %s [OPTIONS] {PST FILENAME}\n", prog_name); | 709 printf("Usage: %s [OPTIONS] {PST FILENAME}\n", prog_name); |
700 printf("OPTIONS:\n"); | 710 printf("OPTIONS:\n"); |
701 printf("\t-V\t- Version. Display program version\n"); | 711 printf("\t-V\t- Version. Display program version\n"); |
712 printf("\t-C charset\t- character set for items with unspecified character set\n"); | |
702 printf("\t-D\t- Include deleted items in output\n"); | 713 printf("\t-D\t- Include deleted items in output\n"); |
703 printf("\t-M\t- Write emails in the MH (rfc822) format\n"); | 714 printf("\t-M\t- Write emails in the MH (rfc822) format\n"); |
704 printf("\t-S\t- Separate. Write emails in the separate format\n"); | 715 printf("\t-S\t- Separate. Write emails in the separate format\n"); |
705 printf("\t-b\t- Don't save RTF-Body attachments\n"); | 716 printf("\t-b\t- Don't save RTF-Body attachments\n"); |
706 printf("\t-c[v|l]\t- Set the Contact output mode. -cv = VCard, -cl = EMail list\n"); | 717 printf("\t-c[v|l]\t- Set the Contact output mode. -cv = VCard, -cl = EMail list\n"); |