Commit da88ef54 da88ef5409ea73f0de3d4bf66b766f2ee297d8c1 by Sergey Poznyakoff

Don't bail out if the mailbox does not exist.

1 parent 71152562
Showing 1 changed file with 14 additions and 3 deletions
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
38 #include <mailutils/observer.h> 38 #include <mailutils/observer.h>
39 #include <mailutils/registrar.h> 39 #include <mailutils/registrar.h>
40 #include <mailutils/stream.h> 40 #include <mailutils/stream.h>
41 #include <mailutils/url.h>
41 42
42 static char* show_field; 43 static char* show_field;
43 static int show_to; 44 static int show_to;
...@@ -348,9 +349,16 @@ main(int argc, char **argv) ...@@ -348,9 +349,16 @@ main(int argc, char **argv)
348 349
349 if (status != 0) 350 if (status != 0)
350 { 351 {
351 fprintf (stderr, "could not open mailbox <%s>: %s\n", 352 url_t url = NULL;
352 mailbox_name ? mailbox_name : "default", 353
354 mailbox_get_url (mbox, &url);
355 if (status == ENOENT)
356 status = 2;
357 else
358 fprintf (stderr, "could not open mailbox %s: %s\n",
359 url_to_string (url),
353 mu_errstring(status)); 360 mu_errstring(status));
361
354 goto cleanup; 362 goto cleanup;
355 } 363 }
356 364
...@@ -366,8 +374,11 @@ main(int argc, char **argv) ...@@ -366,8 +374,11 @@ main(int argc, char **argv)
366 374
367 if (status != 0) 375 if (status != 0)
368 { 376 {
377 url_t url = NULL;
378
379 mailbox_get_url (mbox, &url);
369 fprintf (stderr, "could not scan mailbox <%s>: %s\n", 380 fprintf (stderr, "could not scan mailbox <%s>: %s\n",
370 mailbox_name ? mailbox_name : "default", 381 url_to_string (url),
371 mu_errstring(status)); 382 mu_errstring(status));
372 goto cleanup; 383 goto cleanup;
373 } 384 }
......