Commit d1512e84 d1512e84975794c434ba15345c485d54df35f487 by Wojciech Polak

(main): Use mu_register_all_mbox_formats().

1 parent d5afc462
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000, 2001, 2002, 2003,
3 2004 Free Software Foundation, Inc.
3 4
4 GNU Mailutils is free software; you can redistribute it and/or modify 5 GNU Mailutils is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
...@@ -21,9 +22,10 @@ ...@@ -21,9 +22,10 @@
21 22
22 #include "readmsg.h" 23 #include "readmsg.h"
23 24
24 #define WEEDLIST_SEPARATOR " :," 25 #define WEEDLIST_SEPARATOR " :,"
25 26
26 static void print_header __P ((message_t, int no_header, int all_header, const char *weedlst)); 27 static void print_header __P ((message_t, int no_header,
28 int all_header, const char *weedlst));
27 static void print_body __P ((message_t)); 29 static void print_body __P ((message_t));
28 static int string_starts_with __P ((const char * s1, const char *s2)); 30 static int string_starts_with __P ((const char * s1, const char *s2));
29 31
...@@ -236,21 +238,15 @@ main (int argc, char **argv) ...@@ -236,21 +238,15 @@ main (int argc, char **argv)
236 #endif 238 #endif
237 mu_argp_parse (&argp, &argc, &argv, 0, readmsg_argp_capa, &index, NULL); 239 mu_argp_parse (&argp, &argc, &argv, 0, readmsg_argp_capa, &index, NULL);
238 240
239 /* Registration. */ 241 /* register the formats. */
240 { 242 mu_register_all_mbox_formats ();
241 list_t bookie;
242 registrar_get_list (&bookie);
243 list_append (bookie, mbox_record);
244 list_append (bookie, path_record);
245 list_append (bookie, pop_record);
246 list_append (bookie, imap_record);
247 }
248 243
249 status = mailbox_create_default (&mbox, mailbox_name); 244 status = mailbox_create_default (&mbox, mailbox_name);
250 if (status != 0) 245 if (status != 0)
251 { 246 {
252 mu_error (_("could not create mailbox: %s"), 247 fprintf (stderr, _("Couldn't create mailbox <%s>: %s.\n"),
253 mu_strerror(status)); 248 mailbox_name ? mailbox_name : _("default"),
249 mu_strerror(status));
254 exit (2); 250 exit (2);
255 } 251 }
256 252
...@@ -268,9 +264,8 @@ main (int argc, char **argv) ...@@ -268,9 +264,8 @@ main (int argc, char **argv)
268 url_t url = NULL; 264 url_t url = NULL;
269 265
270 mailbox_get_url (mbox, &url); 266 mailbox_get_url (mbox, &url);
271 mu_error (_("can't open mailbox %s: %s"), 267 fprintf (stderr, _("Couldn't open mailbox <%s>: %s.\n"),
272 url_to_string (url), 268 url_to_string (url), mu_strerror(status));
273 mu_strerror(status));
274 exit (2); 269 exit (2);
275 } 270 }
276 271
...@@ -301,7 +296,9 @@ main (int argc, char **argv) ...@@ -301,7 +296,9 @@ main (int argc, char **argv)
301 else 296 else
302 putchar ('\n'); 297 putchar ('\n');
303 } 298 }
299
304 putchar ('\n'); 300 putchar ('\n');
301
305 mailbox_close (mbox); 302 mailbox_close (mbox);
306 mailbox_destroy (&mbox); 303 mailbox_destroy (&mbox);
307 return 0; 304 return 0;
......