mailutils capabilities were split, and it now reports failure, rather
than calling failure seccess.
Showing
1 changed file
with
30 additions
and
13 deletions
... | @@ -31,6 +31,7 @@ | ... | @@ -31,6 +31,7 @@ |
31 | #include <mailutils/address.h> | 31 | #include <mailutils/address.h> |
32 | #include <mailutils/attribute.h> | 32 | #include <mailutils/attribute.h> |
33 | #include <mailutils/debug.h> | 33 | #include <mailutils/debug.h> |
34 | #include <mailutils/errno.h> | ||
34 | #include <mailutils/header.h> | 35 | #include <mailutils/header.h> |
35 | #include <mailutils/list.h> | 36 | #include <mailutils/list.h> |
36 | #include <mailutils/mailbox.h> | 37 | #include <mailutils/mailbox.h> |
... | @@ -64,17 +65,14 @@ const char *argp_program_bug_address = "<bug-mailutils@gnu.org>"; | ... | @@ -64,17 +65,14 @@ const char *argp_program_bug_address = "<bug-mailutils@gnu.org>"; |
64 | static char doc[] = "GNU frm -- display From: lines"; | 65 | static char doc[] = "GNU frm -- display From: lines"; |
65 | 66 | ||
66 | static struct argp_option options[] = { | 67 | static struct argp_option options[] = { |
67 | {NULL, 0, NULL, 0, | ||
68 | "frm specific switches:", 0}, | ||
69 | {"debug", 'd', NULL, 0, "Enable debugging output", 0}, | 68 | {"debug", 'd', NULL, 0, "Enable debugging output", 0}, |
70 | {"field", 'f', "NAME", 0, | 69 | {"field", 'f', "NAME", 0, "Header field to display", 0}, |
71 | "Header field to display", 0}, | ||
72 | {"to", 'l', NULL, 0, "Include the To: information", 0}, | 70 | {"to", 'l', NULL, 0, "Include the To: information", 0}, |
73 | {"number", 'n', NULL, 0, "Display message numbers", 0}, | 71 | {"number", 'n', NULL, 0, "Display message numbers", 0}, |
74 | {"Quiet", 'Q', NULL, 0, "Very quiet", 0}, | 72 | {"Quiet", 'Q', NULL, 0, "Very quiet", 0}, |
75 | {"query", 'q', NULL, 0, "Print a message if unread mail", 0}, | 73 | {"query", 'q', NULL, 0, "Print a message if unread mail", 0}, |
76 | {"summary", 'S', NULL, 0, "Print a summary of messages", 0}, | 74 | {"summary",'S', NULL, 0, "Print a summary of messages", 0}, |
77 | {"status", 's', "[nor]", 0, | 75 | {"status", 's', "[nor]",0, |
78 | "Select message with the specific attribute: [n]ew, [r]ead, [u]nread.", 0 }, | 76 | "Select message with the specific attribute: [n]ew, [r]ead, [u]nread.", 0 }, |
79 | {"align", 't', NULL, 0, "Try to align", 0}, | 77 | {"align", 't', NULL, 0, "Try to align", 0}, |
80 | {0, 0, 0, 0} | 78 | {0, 0, 0, 0} |
... | @@ -161,7 +159,9 @@ static struct argp argp = { | ... | @@ -161,7 +159,9 @@ static struct argp argp = { |
161 | }; | 159 | }; |
162 | 160 | ||
163 | static const char *frm_argp_capa[] = { | 161 | static const char *frm_argp_capa[] = { |
164 | "mailutils", | 162 | "common", |
163 | "licence", | ||
164 | "mailbox", | ||
165 | NULL | 165 | NULL |
166 | }; | 166 | }; |
167 | 167 | ||
... | @@ -330,10 +330,13 @@ main(int argc, char **argv) | ... | @@ -330,10 +330,13 @@ main(int argc, char **argv) |
330 | observable_t observable; | 330 | observable_t observable; |
331 | 331 | ||
332 | status = mailbox_create_default (&mbox, mailbox_name); | 332 | status = mailbox_create_default (&mbox, mailbox_name); |
333 | |||
333 | if (status != 0) | 334 | if (status != 0) |
334 | { | 335 | { |
335 | fprintf (stderr, "could not create mailbox object\n"); | 336 | fprintf (stderr, "could not create mailbox <%s>: %s\n", |
336 | exit (3); | 337 | mailbox_name ? mailbox_name : "default", |
338 | mu_errstring(status)); | ||
339 | goto cleanup; | ||
337 | } | 340 | } |
338 | 341 | ||
339 | if (dbug) | 342 | if (dbug) |
... | @@ -344,10 +347,13 @@ main(int argc, char **argv) | ... | @@ -344,10 +347,13 @@ main(int argc, char **argv) |
344 | } | 347 | } |
345 | 348 | ||
346 | status = mailbox_open (mbox, MU_STREAM_READ); | 349 | status = mailbox_open (mbox, MU_STREAM_READ); |
350 | |||
347 | if (status != 0) | 351 | if (status != 0) |
348 | { | 352 | { |
349 | fprintf (stderr, "could not open mailbox\n"); | 353 | fprintf (stderr, "could not open mailbox <%s>: %s\n", |
350 | exit (4); | 354 | mailbox_name ? mailbox_name : "default", |
355 | mu_errstring(status)); | ||
356 | goto cleanup; | ||
351 | } | 357 | } |
352 | 358 | ||
353 | if (! be_quiet) | 359 | if (! be_quiet) |
... | @@ -358,16 +364,27 @@ main(int argc, char **argv) | ... | @@ -358,16 +364,27 @@ main(int argc, char **argv) |
358 | observable_attach (observable, MU_EVT_MESSAGE_ADD, observer); | 364 | observable_attach (observable, MU_EVT_MESSAGE_ADD, observer); |
359 | } | 365 | } |
360 | 366 | ||
361 | mailbox_scan (mbox, 1, &total); | 367 | status = mailbox_scan (mbox, 1, &total); |
368 | |||
369 | if (status != 0) | ||
370 | { | ||
371 | fprintf (stderr, "could not scan mailbox <%s>: %s\n", | ||
372 | mailbox_name ? mailbox_name : "default", | ||
373 | mu_errstring(status)); | ||
374 | goto cleanup; | ||
375 | } | ||
362 | 376 | ||
363 | if (! be_quiet) | 377 | if (! be_quiet) |
364 | { | 378 | { |
365 | observable_detach (observable, observer); | 379 | observable_detach (observable, observer); |
366 | observer_destroy (&observer, mbox); | 380 | observer_destroy (&observer, mbox); |
367 | } | 381 | } |
368 | 382 | cleanup: | |
369 | mailbox_close(mbox); | 383 | mailbox_close(mbox); |
370 | mailbox_destroy(&mbox); | 384 | mailbox_destroy(&mbox); |
385 | |||
386 | if(status != 0) | ||
387 | return 3; | ||
371 | } | 388 | } |
372 | 389 | ||
373 | if (show_summary) | 390 | if (show_summary) | ... | ... |
-
Please register or sign in to post a comment