(main): Use mh_open_folder.
Showing
1 changed file
with
3 additions
and
20 deletions
... | @@ -186,31 +186,14 @@ main (int argc, char **argv) | ... | @@ -186,31 +186,14 @@ main (int argc, char **argv) |
186 | mh_error ("Can not read input mailbox"); | 186 | mh_error ("Can not read input mailbox"); |
187 | exit (1); | 187 | exit (1); |
188 | } | 188 | } |
189 | |||
190 | /* Select and open output mailbox */ | ||
191 | if (mh_check_folder (current_folder)) | ||
192 | exit (0); | ||
193 | |||
194 | if (mailbox_create_default (&output, current_folder)) | ||
195 | { | ||
196 | mh_error ("Can't create output mailbox %s: %s", | ||
197 | current_folder, strerror (errno)); | ||
198 | exit (1); | ||
199 | } | ||
200 | |||
201 | if (mailbox_open (output, MU_STREAM_RDWR|MU_STREAM_CREAT)) | ||
202 | { | ||
203 | mh_error ("Can't open mailbox %s: %s", current_folder, | ||
204 | strerror (errno)); | ||
205 | exit (1); | ||
206 | } | ||
207 | 189 | ||
190 | output = mh_open_folder (current_folder, 1); | ||
208 | if (mailbox_messages_count (output, &lastmsg) != 0) | 191 | if (mailbox_messages_count (output, &lastmsg) != 0) |
209 | { | 192 | { |
210 | mh_error ("Can not read output mailbox"); | 193 | mh_error ("Can not read output mailbox"); |
211 | exit (1); | 194 | exit (1); |
212 | } | 195 | } |
213 | 196 | ||
214 | buffer = xmalloc (width); | 197 | buffer = xmalloc (width); |
215 | 198 | ||
216 | /* Fixup options */ | 199 | /* Fixup options */ |
... | @@ -242,7 +225,7 @@ main (int argc, char **argv) | ... | @@ -242,7 +225,7 @@ main (int argc, char **argv) |
242 | 225 | ||
243 | if (n == 1 && changecur) | 226 | if (n == 1 && changecur) |
244 | { | 227 | { |
245 | message_t msg; | 228 | message_t msg = NULL; |
246 | 229 | ||
247 | mailbox_get_message (output, lastmsg+1, &msg); | 230 | mailbox_get_message (output, lastmsg+1, &msg); |
248 | mh_message_number (msg, ¤t_message); | 231 | mh_message_number (msg, ¤t_message); | ... | ... |
-
Please register or sign in to post a comment