Updated calls to mh_format
Showing
2 changed files
with
10 additions
and
16 deletions
... | @@ -129,17 +129,17 @@ opt_handler (int key, char *arg, void *unused) | ... | @@ -129,17 +129,17 @@ opt_handler (int key, char *arg, void *unused) |
129 | } | 129 | } |
130 | 130 | ||
131 | void | 131 | void |
132 | list_message (mh_format_t *format, mailbox_t mbox, size_t msgno, | 132 | list_message (mh_format_t *format, mailbox_t mbox, size_t msgno, size_t width) |
133 | char *buffer, size_t width) | ||
134 | { | 133 | { |
135 | message_t msg; | 134 | message_t msg; |
135 | char *buf = NULL; | ||
136 | 136 | ||
137 | buffer[0] = 0; | ||
138 | mailbox_get_message (mbox, msgno, &msg); | 137 | mailbox_get_message (mbox, msgno, &msg); |
139 | mh_format (format, msg, msgno, buffer, width); | 138 | mh_format (format, msg, msgno, width, &buf); |
140 | printf ("%s\n", buffer); | 139 | printf ("%s\n", buf); |
141 | if (audit_fp) | 140 | if (audit_fp) |
142 | fprintf (audit_fp, "%s\n", buffer); | 141 | fprintf (audit_fp, "%s\n", buf); |
142 | free (buf); | ||
143 | } | 143 | } |
144 | 144 | ||
145 | int | 145 | int |
... | @@ -151,7 +151,6 @@ main (int argc, char **argv) | ... | @@ -151,7 +151,6 @@ main (int argc, char **argv) |
151 | size_t lastmsg; | 151 | size_t lastmsg; |
152 | int f_truncate = 0; | 152 | int f_truncate = 0; |
153 | int f_changecur = 0; | 153 | int f_changecur = 0; |
154 | char *buffer; | ||
155 | mh_format_t format; | 154 | mh_format_t format; |
156 | int rc; | 155 | int rc; |
157 | 156 | ||
... | @@ -210,8 +209,6 @@ main (int argc, char **argv) | ... | @@ -210,8 +209,6 @@ main (int argc, char **argv) |
210 | exit (1); | 209 | exit (1); |
211 | } | 210 | } |
212 | 211 | ||
213 | buffer = xmalloc (width); | ||
214 | |||
215 | /* Fixup options */ | 212 | /* Fixup options */ |
216 | if (truncate_source == -1) | 213 | if (truncate_source == -1) |
217 | truncate_source = f_truncate; | 214 | truncate_source = f_truncate; |
... | @@ -249,7 +246,7 @@ main (int argc, char **argv) | ... | @@ -249,7 +246,7 @@ main (int argc, char **argv) |
249 | } | 246 | } |
250 | 247 | ||
251 | if (!quiet) | 248 | if (!quiet) |
252 | list_message (&format, output, lastmsg + n, buffer, width); | 249 | list_message (&format, output, lastmsg + n, width); |
253 | 250 | ||
254 | if (truncate_source) | 251 | if (truncate_source) |
255 | { | 252 | { | ... | ... |
... | @@ -71,8 +71,6 @@ static mh_format_t format; | ... | @@ -71,8 +71,6 @@ static mh_format_t format; |
71 | 71 | ||
72 | static mh_msgset_t msgset; | 72 | static mh_msgset_t msgset; |
73 | 73 | ||
74 | static char *buffer; | ||
75 | |||
76 | void list_message __P((mailbox_t mbox, message_t msg, size_t num, void *data)); | 74 | void list_message __P((mailbox_t mbox, message_t msg, size_t num, void *data)); |
77 | void print_header __P((mailbox_t mbox)); | 75 | void print_header __P((mailbox_t mbox)); |
78 | void clear_screen __P((void)); | 76 | void clear_screen __P((void)); |
... | @@ -171,8 +169,6 @@ main (int argc, char **argv) | ... | @@ -171,8 +169,6 @@ main (int argc, char **argv) |
171 | 169 | ||
172 | mbox = mh_open_folder (current_folder, 0); | 170 | mbox = mh_open_folder (current_folder, 0); |
173 | 171 | ||
174 | buffer = xmalloc (width); | ||
175 | |||
176 | argc -= index; | 172 | argc -= index; |
177 | argv += index; | 173 | argv += index; |
178 | if ((argc == 0 || strcmp (argv[0], "all") == 0) && !reverse) | 174 | if ((argc == 0 || strcmp (argv[0], "all") == 0) && !reverse) |
... | @@ -268,7 +264,8 @@ clear_screen () | ... | @@ -268,7 +264,8 @@ clear_screen () |
268 | void | 264 | void |
269 | list_message (mailbox_t mbox, message_t msg, size_t num, void *data) | 265 | list_message (mailbox_t mbox, message_t msg, size_t num, void *data) |
270 | { | 266 | { |
271 | buffer[0] = 0; | 267 | char *buffer; |
272 | mh_format (&format, msg, num, buffer, width); | 268 | mh_format (&format, msg, num, width, &buffer); |
273 | printf ("%s\n", buffer); | 269 | printf ("%s\n", buffer); |
270 | free (buffer); | ||
274 | } | 271 | } | ... | ... |
-
Please register or sign in to post a comment