Commit 6f3ab756 6f3ab75605f075ffe61bbfb2b57e487605f6b4f7 by Sergey Poznyakoff

Implemented -audit.

1 parent 3fea7765
Showing 1 changed file with 11 additions and 1 deletions
...@@ -62,7 +62,8 @@ struct mh_option mh_option[] = { ...@@ -62,7 +62,8 @@ struct mh_option mh_option[] = {
62 static char *format_str = mh_list_format; 62 static char *format_str = mh_list_format;
63 static int width = 80; 63 static int width = 80;
64 static char *input_file; 64 static char *input_file;
65 static char *audit_file; /*FIXME: unused*/ 65 static char *audit_file;
66 static FILE *audit_fp;
66 static int changecur = -1; 67 static int changecur = -1;
67 static int truncate = -1; 68 static int truncate = -1;
68 static int quiet = 0; 69 static int quiet = 0;
...@@ -130,6 +131,8 @@ list_message (mh_format_t *format, mailbox_t mbox, size_t msgno, ...@@ -130,6 +131,8 @@ list_message (mh_format_t *format, mailbox_t mbox, size_t msgno,
130 mailbox_get_message (mbox, msgno, &msg); 131 mailbox_get_message (mbox, msgno, &msg);
131 mh_format (format, msg, msgno, buffer, width); 132 mh_format (format, msg, msgno, buffer, width);
132 printf ("%s\n", buffer); 133 printf ("%s\n", buffer);
134 if (audit_fp)
135 fprintf (audit_fp, "%s\n", buffer);
133 } 136 }
134 137
135 int 138 int
...@@ -217,6 +220,10 @@ main (int argc, char **argv) ...@@ -217,6 +220,10 @@ main (int argc, char **argv)
217 truncate = f_truncate; 220 truncate = f_truncate;
218 if (changecur == -1) 221 if (changecur == -1)
219 changecur = f_changecur; 222 changecur = f_changecur;
223
224 /* Open audit file, if specified */
225 if (audit_file)
226 audit_fp = mh_audit_open (audit_file, input);
220 227
221 for (n = 1; n <= total; n++) 228 for (n = 1; n <= total; n++)
222 { 229 {
...@@ -265,6 +272,9 @@ main (int argc, char **argv) ...@@ -265,6 +272,9 @@ main (int argc, char **argv)
265 mailbox_close (input); 272 mailbox_close (input);
266 mailbox_destroy (&input); 273 mailbox_destroy (&input);
267 274
275 if (audit_fp)
276 mh_audit_close (audit_fp);
277
268 return 0; 278 return 0;
269 } 279 }
270 280
......