comparison src/readpst.c @ 59:7d5c637aaafb

General cleanup and code fixes. Use autoscan to cleanup our autoconf system. Use autoconf to detect when we need to use our XGetopt files and other header files. Decode BCC field. Fix missing LE32_CPU byte swapping for FILETIME types.
author Carl Byington <carl@five-ten-sg.com>
date Thu, 14 Feb 2008 14:55:32 -0800
parents 034641c26ab9
children cfd6175f9334
comparison
equal deleted inserted replaced
58:a8b772313ff4 59:7d5c637aaafb
3 * Part of the LibPST project 3 * Part of the LibPST project
4 * Written by David Smith 4 * Written by David Smith
5 * dave.s@earthcorp.com 5 * dave.s@earthcorp.com
6 */ 6 */
7 #include "define.h" 7 #include "define.h"
8 8 #include "libstrfunc.h"
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <time.h>
12 #include <string.h>
13 #include <ctype.h>
14 #include <limits.h>
15 #include <errno.h>
16 #include "vbuf.h" 9 #include "vbuf.h"
17
18 #ifndef _WIN32
19 # include <unistd.h>
20 # include <sys/stat.h> //mkdir
21
22 // for reading of directory and clearing in function mk_seperate_dir
23 # include <sys/types.h>
24 # include <dirent.h>
25 #else
26 # include <direct.h>
27 # define chdir _chdir
28 # define int32_t __int32
29 #endif
30
31 #ifndef __GNUC__
32 # include "XGetopt.h"
33 #endif
34
35 #include "libstrfunc.h" // for base64_encoding
36
37 #include "libpst.h" 10 #include "libpst.h"
38 #include "common.h" 11 #include "common.h"
39 #include "timeconv.h" 12 #include "timeconv.h"
40 #include "lzfu.h" 13 #include "lzfu.h"
14
41 #define OUTPUT_TEMPLATE "%s" 15 #define OUTPUT_TEMPLATE "%s"
42 #define OUTPUT_KMAIL_DIR_TEMPLATE ".%s.directory" 16 #define OUTPUT_KMAIL_DIR_TEMPLATE ".%s.directory"
43 #define KMAIL_INDEX ".%s.index" 17 #define KMAIL_INDEX ".%s.index"
44 #define SEP_MAIL_FILE_TEMPLATE "%i" /* "%09i" */ 18 #define SEP_MAIL_FILE_TEMPLATE "%i" /* "%09i" */
45 19
51 #ifndef WIN32 25 #ifndef WIN32
52 #define D_MKDIR(x) mkdir(x, PERM_DIRS) 26 #define D_MKDIR(x) mkdir(x, PERM_DIRS)
53 #else 27 #else
54 #define D_MKDIR(x) mkdir(x) 28 #define D_MKDIR(x) mkdir(x)
55 #endif 29 #endif
30
56 struct file_ll { 31 struct file_ll {
57 char *name; 32 char *name;
58 char *dname; 33 char *dname;
59 FILE * output; 34 FILE * output;
60 int32_t stored_count; 35 int32_t stored_count;
348 return 0; 323 return 0;
349 } 324 }
350 325
351 if (output_mode != OUTPUT_QUIET) printf("Opening PST file and indexes...\n"); 326 if (output_mode != OUTPUT_QUIET) printf("Opening PST file and indexes...\n");
352 327
353 RET_DERROR(pst_open(&pstfile, fname, "r"), 1, ("Error opening File\n")); 328 RET_DERROR(pst_open(&pstfile, fname), 1, ("Error opening File\n"));
354 RET_DERROR(pst_load_index(&pstfile), 2, ("Index Error\n")); 329 RET_DERROR(pst_load_index(&pstfile), 2, ("Index Error\n"));
355 330
356 pst_load_extended_attributes(&pstfile); 331 pst_load_extended_attributes(&pstfile);
357 332
358 if (chdir(output_dir)) { 333 if (chdir(output_dir)) {