Added -d flags.
Showing
2 changed files
with
31 additions
and
5 deletions
... | @@ -30,6 +30,8 @@ UserAgent (header_t hdr) | ... | @@ -30,6 +30,8 @@ UserAgent (header_t hdr) |
30 | && sz != 0) | 30 | && sz != 0) |
31 | return agent; | 31 | return agent; |
32 | 32 | ||
33 | /* Some MUAs, like Pine, put their name in the Message-Id, so print it as | ||
34 | a last ditch attempt at getting an idea who produced the date. */ | ||
33 | if (header_get_value (hdr, "Message-Id", agent, sizeof (agent), &sz) == 0 | 35 | if (header_get_value (hdr, "Message-Id", agent, sizeof (agent), &sz) == 0 |
34 | && sz != 0) | 36 | && sz != 0) |
35 | return agent; | 37 | return agent; |
... | @@ -45,6 +47,19 @@ main (int argc, char **argv) | ... | @@ -45,6 +47,19 @@ main (int argc, char **argv) |
45 | size_t count = 0; | 47 | size_t count = 0; |
46 | char *mboxname = argv[1]; | 48 | char *mboxname = argv[1]; |
47 | int status; | 49 | int status; |
50 | int debug = 0; | ||
51 | |||
52 | if (strcmp ("-d", mboxname) == 0) | ||
53 | { | ||
54 | mboxname = argv[2]; | ||
55 | debug = 1; | ||
56 | } | ||
57 | |||
58 | if (mboxname == NULL) | ||
59 | { | ||
60 | printf ("Usage: mbox-dates [-d] <mbox>\n"); | ||
61 | exit (1); | ||
62 | } | ||
48 | 63 | ||
49 | /* Register desired mailbox formats. */ | 64 | /* Register desired mailbox formats. */ |
50 | { | 65 | { |
... | @@ -62,11 +77,12 @@ main (int argc, char **argv) | ... | @@ -62,11 +77,12 @@ main (int argc, char **argv) |
62 | exit (1); | 77 | exit (1); |
63 | } | 78 | } |
64 | 79 | ||
65 | { | 80 | if (debug) |
66 | mu_debug_t debug; | 81 | { |
67 | mailbox_get_debug (mbox, &debug); | 82 | mu_debug_t debug; |
68 | // mu_debug_set_level (debug, MU_DEBUG_TRACE|MU_DEBUG_PROT); | 83 | mailbox_get_debug (mbox, &debug); |
69 | } | 84 | mu_debug_set_level (debug, MU_DEBUG_TRACE | MU_DEBUG_PROT); |
85 | } | ||
70 | 86 | ||
71 | if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) | 87 | if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) |
72 | { | 88 | { | ... | ... |
... | @@ -23,7 +23,15 @@ main (int argc, char **argv) | ... | @@ -23,7 +23,15 @@ main (int argc, char **argv) |
23 | char *mbox_name = 0; | 23 | char *mbox_name = 0; |
24 | char *dir_name = 0; | 24 | char *dir_name = 0; |
25 | int status; | 25 | int status; |
26 | int debug = 0; | ||
26 | 27 | ||
28 | if (strcmp("-d", argv[1]) == 0 && argc == 4) | ||
29 | { | ||
30 | debug = 1; | ||
31 | argc--; | ||
32 | argv[1] = argv[2]; | ||
33 | argv[2] = argv[3]; | ||
34 | } | ||
27 | if (argc != 3) | 35 | if (argc != 3) |
28 | { | 36 | { |
29 | printf ("usage: mbox-explode <mbox> <directory>\n"); | 37 | printf ("usage: mbox-explode <mbox> <directory>\n"); |
... | @@ -46,6 +54,7 @@ main (int argc, char **argv) | ... | @@ -46,6 +54,7 @@ main (int argc, char **argv) |
46 | mbox_name, strerror (status)); | 54 | mbox_name, strerror (status)); |
47 | exit (1); | 55 | exit (1); |
48 | } | 56 | } |
57 | if(debug) | ||
49 | { | 58 | { |
50 | mu_debug_t debug; | 59 | mu_debug_t debug; |
51 | mailbox_get_debug (mbox, &debug); | 60 | mailbox_get_debug (mbox, &debug); |
... | @@ -119,3 +128,4 @@ main (int argc, char **argv) | ... | @@ -119,3 +128,4 @@ main (int argc, char **argv) |
119 | 128 | ||
120 | return status; | 129 | return status; |
121 | } | 130 | } |
131 | ... | ... |
-
Please register or sign in to post a comment