comparison src/readpst.c @ 118:0f1492b7fe8b

patch from Fridrich Strba for building on mingw and general cleanup of autoconf files add processing for pst files of type 0x0f start adding support for properly building and installing libpst.so and the header files required to use it. remove version.h since the version number is now in config.h more const correctness issues regarding getopt()
author Carl Byington <carl@five-ten-sg.com>
date Sat, 31 Jan 2009 12:12:36 -0800
parents ed2a260bbb98
children 6395ced2b8b2
comparison
equal deleted inserted replaced
117:0a3d854b53f6 118:0f1492b7fe8b
31 }; 31 };
32 32
33 void process(pst_item *outeritem, pst_desc_ll *d_ptr); 33 void process(pst_item *outeritem, pst_desc_ll *d_ptr);
34 void write_email_body(FILE *f, char *body); 34 void write_email_body(FILE *f, char *body);
35 char* removeCR (char *c); 35 char* removeCR (char *c);
36 int usage(); 36 void usage();
37 int version(); 37 void version();
38 char* mk_kmail_dir(char*); 38 char* mk_kmail_dir(char*);
39 int close_kmail_dir(); 39 int close_kmail_dir();
40 char* mk_recurse_dir(char*); 40 char* mk_recurse_dir(char*);
41 int close_recurse_dir(); 41 int close_recurse_dir();
42 char* mk_separate_dir(char *dir); 42 char* mk_separate_dir(char *dir);
52 void write_appointment(FILE* f_output, pst_item_appointment* appointment, 52 void write_appointment(FILE* f_output, pst_item_appointment* appointment,
53 pst_item_email* email, FILETIME* create_date, FILETIME* modify_date); 53 pst_item_email* email, FILETIME* create_date, FILETIME* modify_date);
54 void create_enter_dir(struct file_ll* f, pst_item *item); 54 void create_enter_dir(struct file_ll* f, pst_item *item);
55 void close_enter_dir(struct file_ll *f); 55 void close_enter_dir(struct file_ll *f);
56 56
57 char* prog_name; 57 const char* prog_name;
58 char* output_dir = "."; 58 char* output_dir = ".";
59 char* kmail_chdir = NULL; 59 char* kmail_chdir = NULL;
60 60
61 // Normal mode just creates mbox format files in the current directory. Each file is named 61 // Normal mode just creates mbox format files in the current directory. Each file is named
62 // the same as the folder's name that it represents 62 // the same as the folder's name that it represents
217 DEBUG_RET(); 217 DEBUG_RET();
218 } 218 }
219 219
220 220
221 221
222 int main(int argc, char** argv) { 222 int main(int argc, char* const* argv) {
223 pst_item *item = NULL; 223 pst_item *item = NULL;
224 pst_desc_ll *d_ptr; 224 pst_desc_ll *d_ptr;
225 char * fname = NULL; 225 char * fname = NULL;
226 char *d_log = NULL; 226 char *d_log = NULL;
227 int c,x; 227 int c,x;
414 DEBUG_RET(); 414 DEBUG_RET();
415 return c; 415 return c;
416 } 416 }
417 417
418 418
419 int usage() { 419 void usage() {
420 DEBUG_ENT("usage"); 420 DEBUG_ENT("usage");
421 version(); 421 version();
422 printf("Usage: %s [OPTIONS] {PST FILENAME}\n", prog_name); 422 printf("Usage: %s [OPTIONS] {PST FILENAME}\n", prog_name);
423 printf("OPTIONS:\n"); 423 printf("OPTIONS:\n");
424 printf("\t-V\t- Version. Display program version\n"); 424 printf("\t-V\t- Version. Display program version\n");
434 printf("\t-o <dirname>\t- Output directory to write files to. CWD is changed *after* opening pst file\n"); 434 printf("\t-o <dirname>\t- Output directory to write files to. CWD is changed *after* opening pst file\n");
435 printf("\t-q\t- Quiet. Only print error messages\n"); 435 printf("\t-q\t- Quiet. Only print error messages\n");
436 printf("\t-r\t- Recursive. Output in a recursive format\n"); 436 printf("\t-r\t- Recursive. Output in a recursive format\n");
437 printf("\t-w\t- Overwrite any output mbox files\n"); 437 printf("\t-w\t- Overwrite any output mbox files\n");
438 DEBUG_RET(); 438 DEBUG_RET();
439 return 0; 439 }
440 } 440
441 441
442 442 void version() {
443 int version() {
444 DEBUG_ENT("version"); 443 DEBUG_ENT("version");
445 printf("ReadPST / LibPST v%s\n", VERSION); 444 printf("ReadPST / LibPST v%s\n", VERSION);
446 #if BYTE_ORDER == BIG_ENDIAN 445 #if BYTE_ORDER == BIG_ENDIAN
447 printf("Big Endian implementation being used.\n"); 446 printf("Big Endian implementation being used.\n");
448 #elif BYTE_ORDER == LITTLE_ENDIAN 447 #elif BYTE_ORDER == LITTLE_ENDIAN
452 #endif 451 #endif
453 #ifdef __GNUC__ 452 #ifdef __GNUC__
454 printf("GCC %d.%d : %s %s\n", __GNUC__, __GNUC_MINOR__, __DATE__, __TIME__); 453 printf("GCC %d.%d : %s %s\n", __GNUC__, __GNUC_MINOR__, __DATE__, __TIME__);
455 #endif 454 #endif
456 DEBUG_RET(); 455 DEBUG_RET();
457 return 0;
458 } 456 }
459 457
460 458
461 char *mk_kmail_dir(char *fname) { 459 char *mk_kmail_dir(char *fname) {
462 //change to that directory 460 //change to that directory