58 memset(&ff, 0,
sizeof(ff));
63 DEBUG_WARN((
"ERROR item's desc record is NULL\n"));
70 DEBUG_INFO((
"About to process item @ %p.\n", item));
72 if (item->message_store) {
74 DIE((
"A second message_store has been found. Sorry, this must be an error.\n"));
77 if (item->folder && d_ptr->
child) {
80 printf(
"Folder \"%s\"\n", item->file_as.str);
87 DEBUG_INFO((
"I have a contact, but the folder isn't a contacts folder. Processing anyway\n"));
90 if (item->contact->fullname.str)
98 DEBUG_INFO((
"I have an email, but the folder isn't an email folder. Processing anyway\n"));
102 if (item->email->arrival_date) {
105 if (dateresultlen < 1)
106 DIE((
"Date format error in -f option.\n"));
107 printf(
"\tDate: %s", time_buffer);
112 if (item->email->outlook_sender_name.str)
113 printf(
"\tFrom: %s", item->email->outlook_sender_name.str);
117 if (item->email->outlook_recipient_name.str)
118 printf(
"\tTo: %s", item->email->outlook_recipient_name.str);
121 if (item->email->cc_address.str)
122 printf(
"\tCC: %s", item->email->cc_address.str);
125 if (item->email->bcc_address.str)
126 printf(
"\tBCC: %s", item->email->bcc_address.str);
130 if (item->subject.str)
131 printf(
"\tSubject: %s", item->subject.str);
140 DEBUG_INFO((
"I have a journal entry, but folder isn't specified as a journal type. Processing...\n"));
142 if (item->subject.str)
146 char time_buffer[30];
149 DEBUG_INFO((
"Processing Appointment Entry\n"));
151 DEBUG_INFO((
"I have an appointment, but folder isn't specified as an appointment type. Processing...\n"));
153 printf(
"Appointment");
154 if (item->subject.str)
156 if (item->appointment->start)
158 if (item->appointment->end)
160 printf(
"\tALL DAY: %s", (item->appointment->all_day==1 ?
"Yes" :
"No"));
165 DEBUG_INFO((
"Unknown item type. %i. Ascii1=\"%s\"\n",
166 item->type, item->ascii_type));
177 if (result) free(result);
185 printf(
"Usage: %s [OPTIONS] {PST FILENAME}\n",
prog_name);
186 printf(
"OPTIONS:\n");
187 printf(
"\t-d <filename> \t- Debug to file. This is a binary log. Use readlog to print it\n");
188 printf(
"\t-l\t- Print the date, CC and BCC fields of emails too (by default only the From and Subject)\n");
189 printf(
"\t-f <date_format> \t- Select the date format in ctime format (by default \"%%F %%T\")\n");
190 printf(
"\t-h\t- Help. This screen\n");
191 printf(
"\t-V\t- Version. Display program version\n");
198 printf(
"lspst / LibPST v%s\n",
VERSION);
199 #if BYTE_ORDER == BIG_ENDIAN 200 printf(
"Big Endian implementation being used.\n");
201 #elif BYTE_ORDER == LITTLE_ENDIAN 202 printf(
"Little Endian implementation being used.\n");
204 # error "Byte order not supported by this library" 210 int main(
int argc,
char*
const* argv) {
218 char *defaultfmtdate =
"%F %T";
221 while ((c =
getopt(argc, argv,
"d:f:lhV"))!= -1) {
249 if (!d_log) d_log =
"lspst.log";
250 #endif // defined DEBUG_ALL 271 DIE((
"Could not get root record\n"));
276 if (!(temp = strrchr(argv[1],
'/')))
277 if (!(temp = strrchr(argv[1],
'\\')))
288 if (!d_ptr)
DIE((
"Top of folders record not found. Cannot continue\n"));
307 while ((fname = strpbrk(fname,
"/\\:")))
void process(pst_item *outeritem, pst_desc_tree *d_ptr, struct options o)
void create_enter_dir(struct file_ll *f, pst_item *item)
int main(int argc, char *const *argv)
void canonicalize_filename(char *fname)
void pst_freeItem(pst_item *item)
Free the item returned by pst_parse_item().
int pst_load_extended_attributes(pst_file *pf)
Try to load the extended attributes from the pst file.
char * pst_rfc2426_escape(char *str, char **buf, size_t *buflen)
Add any necessary escape characters for rfc2426 vcard format.
int pst_close(pst_file *pf)
Close a pst file.
#define PST_TYPE_SCHEDULE
This contains the common mapi elements, and pointers to structures for each major mapi item type...
int getopt(int argc, char *const *argv, char *optstring)
pst_string file_as
mapi element 0x3001 PR_DISPLAY_NAME
struct pst_desc_tree * next
pst_desc_tree * pst_getTopOfFolders(pst_file *pf, const pst_item *root)
Get the top of folders descriptor tree.
struct pst_desc_tree * child
int pst_open(pst_file *pf, const char *name, const char *charset)
Open a pst file.
pst_item_message_store * message_store
message store mapi elements
int type
derived from mapi elements 0x001a PR_MESSAGE_CLASS or 0x3613 PR_CONTAINER_CLASS
size_t pst_fileTimeToString(const FILETIME *filetime, const char *date_format, char *result)
Convert a FILETIME to string in date_format format.
pst_item * pst_parse_item(pst_file *pf, pst_desc_tree *d_ptr, pst_id2_tree *m_head)
Process a high level object from the pst file.
void close_enter_dir(struct file_ll *f)
void debug_print(char *fmt,...)
char * pst_rfc2445_datetime_format(const FILETIME *ft, int buflen, char *result)
Convert a FILETIME into rfc2445 date/time format 19531015T231000Z.
pst_desc_tree * d_head
the head and tail of the top level of the descriptor tree
#define PST_TYPE_APPOINTMENT
#define DEBUG_INIT(fname, mutex)
int pst_load_index(pst_file *pf)
Load the index entries from the pst file.
void usage(char *prog_name)
pst_item_folder * folder
folder mapi elements
int32_t item_count
mapi element 0x3602 PR_CONTENT_COUNT
void pst_convert_utf8(pst_item *item, pst_string *str)
Convert str to utf8 if possible; null strings are converted into empty strings.