Replaced strerror() with mu_errstring().
Showing
26 changed files
with
106 additions
and
115 deletions
... | @@ -435,21 +435,21 @@ notify_user (const char *user, const char *device, const char *path, off_t offse | ... | @@ -435,21 +435,21 @@ notify_user (const char *user, const char *device, const char *path, off_t offse |
435 | || (status = mailbox_open (mbox, MU_STREAM_READ)) != 0) | 435 | || (status = mailbox_open (mbox, MU_STREAM_READ)) != 0) |
436 | { | 436 | { |
437 | syslog (LOG_ERR, "can't open mailbox %s: %s", | 437 | syslog (LOG_ERR, "can't open mailbox %s: %s", |
438 | path, strerror (status)); | 438 | path, mu_errstring (status)); |
439 | return; | 439 | return; |
440 | } | 440 | } |
441 | 441 | ||
442 | if ((status = mailbox_get_stream (mbox, &stream))) | 442 | if ((status = mailbox_get_stream (mbox, &stream))) |
443 | { | 443 | { |
444 | syslog (LOG_ERR, "can't get stream for mailbox %s: %s", | 444 | syslog (LOG_ERR, "can't get stream for mailbox %s: %s", |
445 | path, strerror (status)); | 445 | path, mu_errstring (status)); |
446 | return; | 446 | return; |
447 | } | 447 | } |
448 | 448 | ||
449 | if ((status = stream_size (stream, (off_t *) &size))) | 449 | if ((status = stream_size (stream, (off_t *) &size))) |
450 | { | 450 | { |
451 | syslog (LOG_ERR, "can't get stream size (mailbox %s): %s", | 451 | syslog (LOG_ERR, "can't get stream size (mailbox %s): %s", |
452 | path, strerror (status)); | 452 | path, mu_errstring (status)); |
453 | return; | 453 | return; |
454 | } | 454 | } |
455 | 455 | ||
... | @@ -462,18 +462,18 @@ notify_user (const char *user, const char *device, const char *path, off_t offse | ... | @@ -462,18 +462,18 @@ notify_user (const char *user, const char *device, const char *path, off_t offse |
462 | stream_read (stream, blurb, size, offset, &n); | 462 | stream_read (stream, blurb, size, offset, &n); |
463 | blurb[size] = 0; | 463 | blurb[size] = 0; |
464 | 464 | ||
465 | if (mailbox_create (&tmp, "/dev/null") != 0 | 465 | if ((status = mailbox_create (&tmp, "/dev/null")) != 0 |
466 | || mailbox_open (tmp, MU_STREAM_READ) != 0) | 466 | || (status = mailbox_open (tmp, MU_STREAM_READ)) != 0) |
467 | { | 467 | { |
468 | syslog (LOG_ERR, "can't create temporary mailbox: %s", | 468 | syslog (LOG_ERR, "can't create temporary mailbox: %s", |
469 | strerror (status)); | 469 | mu_errstring (status)); |
470 | return; | 470 | return; |
471 | } | 471 | } |
472 | 472 | ||
473 | if ((status = memory_stream_create (&stream, 0, 0))) | 473 | if ((status = memory_stream_create (&stream, 0, 0))) |
474 | { | 474 | { |
475 | syslog (LOG_ERR, "can't create temporary stream: %s", | 475 | syslog (LOG_ERR, "can't create temporary stream: %s", |
476 | strerror (status)); | 476 | mu_errstring (status)); |
477 | return; | 477 | return; |
478 | } | 478 | } |
479 | 479 | ... | ... |
... | @@ -54,6 +54,7 @@ | ... | @@ -54,6 +54,7 @@ |
54 | #include <mailutils/stream.h> | 54 | #include <mailutils/stream.h> |
55 | #include <mailutils/mutil.h> | 55 | #include <mailutils/mutil.h> |
56 | #include <mailutils/error.h> | 56 | #include <mailutils/error.h> |
57 | #include <mailutils/errno.h> | ||
57 | 58 | ||
58 | #include <argcv.h> | 59 | #include <argcv.h> |
59 | #include <mu_argp.h> | 60 | #include <mu_argp.h> | ... | ... |
... | @@ -7,7 +7,7 @@ LDLIBS = -lsocket | ... | @@ -7,7 +7,7 @@ LDLIBS = -lsocket |
7 | # On GNU/Linux (if compile with threads) | 7 | # On GNU/Linux (if compile with threads) |
8 | #LDLIBS = -lpthread | 8 | #LDLIBS = -lpthread |
9 | 9 | ||
10 | MULIBS = ../mailbox/.libs/libmailbox.a ../lib/libmailutils.a | 10 | MULIBS = ../mailbox/.libs/libmailbox.a ../lib/.libs/libmailutils.a |
11 | 11 | ||
12 | EXES = addr mbox-explode mbox-dates mbox-auth url-parse mbox-check mimetest msg-send | 12 | EXES = addr mbox-explode mbox-dates mbox-auth url-parse mbox-check mimetest msg-send |
13 | 13 | ... | ... |
... | @@ -4,35 +4,6 @@ | ... | @@ -4,35 +4,6 @@ |
4 | 4 | ||
5 | #define EPARSE ENOENT | 5 | #define EPARSE ENOENT |
6 | 6 | ||
7 | static const char * | ||
8 | err_name (int e) | ||
9 | { | ||
10 | struct | ||
11 | { | ||
12 | int e; | ||
13 | const char *s; | ||
14 | } | ||
15 | map[] = | ||
16 | { | ||
17 | #define E(e) { e, #e }, | ||
18 | E (EPARSE) E (EINVAL) E (ENOMEM) | ||
19 | #undef E | ||
20 | { | ||
21 | 0, NULL} | ||
22 | }; | ||
23 | static char s[sizeof (int) * 8 + 3]; | ||
24 | int i; | ||
25 | |||
26 | for (i = 0; map[i].s; i++) | ||
27 | { | ||
28 | if (map[i].e == e) | ||
29 | return map[i].s; | ||
30 | } | ||
31 | sprintf (s, "[%d]", e); | ||
32 | |||
33 | return s; | ||
34 | } | ||
35 | |||
36 | static int | 7 | static int |
37 | parse (const char *str) | 8 | parse (const char *str) |
38 | { | 9 | { |
... | @@ -50,7 +21,7 @@ parse (const char *str) | ... | @@ -50,7 +21,7 @@ parse (const char *str) |
50 | 21 | ||
51 | if (status) | 22 | if (status) |
52 | { | 23 | { |
53 | printf ("%s=> error %s\n\n", str, err_name (status)); | 24 | printf ("%s=> error %s\n\n", str, mu_errname (status)); |
54 | return 0; | 25 | return 0; |
55 | } | 26 | } |
56 | else | 27 | else | ... | ... |
... | @@ -10,10 +10,11 @@ | ... | @@ -10,10 +10,11 @@ |
10 | #include <time.h> | 10 | #include <time.h> |
11 | #include <unistd.h> | 11 | #include <unistd.h> |
12 | 12 | ||
13 | #include <mailutils/mailbox.h> | ||
14 | #include <mailutils/address.h> | 13 | #include <mailutils/address.h> |
15 | #include <mailutils/registrar.h> | 14 | #include <mailutils/errno.h> |
15 | #include <mailutils/mailbox.h> | ||
16 | #include <mailutils/parse822.h> | 16 | #include <mailutils/parse822.h> |
17 | #include <mailutils/registrar.h> | ||
17 | 18 | ||
18 | int | 19 | int |
19 | main (int argc, char **argv) | 20 | main (int argc, char **argv) |
... | @@ -35,7 +36,7 @@ main (int argc, char **argv) | ... | @@ -35,7 +36,7 @@ main (int argc, char **argv) |
35 | if ((status = mailbox_create_default (&mbox, mboxname)) != 0) | 36 | if ((status = mailbox_create_default (&mbox, mboxname)) != 0) |
36 | { | 37 | { |
37 | fprintf (stderr, "could not create <%s>: %s\n", | 38 | fprintf (stderr, "could not create <%s>: %s\n", |
38 | mboxname, strerror (status)); | 39 | mboxname, mu_errstring (status)); |
39 | return status; | 40 | return status; |
40 | } | 41 | } |
41 | 42 | ||
... | @@ -48,7 +49,7 @@ main (int argc, char **argv) | ... | @@ -48,7 +49,7 @@ main (int argc, char **argv) |
48 | if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) | 49 | if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) |
49 | { | 50 | { |
50 | fprintf (stderr, "could not open <%s>: %s\n", | 51 | fprintf (stderr, "could not open <%s>: %s\n", |
51 | mboxname, strerror (status)); | 52 | mboxname, mu_errstring (status)); |
52 | mailbox_destroy (&mbox); | 53 | mailbox_destroy (&mbox); |
53 | exit (1); | 54 | exit (1); |
54 | } | 55 | } |
... | @@ -56,7 +57,7 @@ main (int argc, char **argv) | ... | @@ -56,7 +57,7 @@ main (int argc, char **argv) |
56 | if ((status = mailbox_messages_count (mbox, &count)) != 0) | 57 | if ((status = mailbox_messages_count (mbox, &count)) != 0) |
57 | { | 58 | { |
58 | fprintf (stderr, "could not count <%s>: %s\n", | 59 | fprintf (stderr, "could not count <%s>: %s\n", |
59 | mboxname, strerror (status)); | 60 | mboxname, mu_errstring (status)); |
60 | mailbox_close (mbox); | 61 | mailbox_close (mbox); |
61 | mailbox_destroy (&mbox); | 62 | mailbox_destroy (&mbox); |
62 | exit (1); | 63 | exit (1); | ... | ... |
... | @@ -10,10 +10,11 @@ | ... | @@ -10,10 +10,11 @@ |
10 | #include <time.h> | 10 | #include <time.h> |
11 | #include <unistd.h> | 11 | #include <unistd.h> |
12 | 12 | ||
13 | #include <mailutils/mailbox.h> | ||
14 | #include <mailutils/address.h> | 13 | #include <mailutils/address.h> |
15 | #include <mailutils/registrar.h> | 14 | #include <mailutils/errno.h> |
15 | #include <mailutils/mailbox.h> | ||
16 | #include <mailutils/parse822.h> | 16 | #include <mailutils/parse822.h> |
17 | #include <mailutils/registrar.h> | ||
17 | 18 | ||
18 | 19 | ||
19 | static const char * | 20 | static const char * |
... | @@ -73,7 +74,7 @@ main (int argc, char **argv) | ... | @@ -73,7 +74,7 @@ main (int argc, char **argv) |
73 | if ((status = mailbox_create_default (&mbox, mboxname)) != 0) | 74 | if ((status = mailbox_create_default (&mbox, mboxname)) != 0) |
74 | { | 75 | { |
75 | fprintf (stderr, "could not create <%s>: %s\n", | 76 | fprintf (stderr, "could not create <%s>: %s\n", |
76 | mboxname, strerror (status)); | 77 | mboxname, mu_errstring (status)); |
77 | exit (1); | 78 | exit (1); |
78 | } | 79 | } |
79 | 80 | ||
... | @@ -86,7 +87,7 @@ main (int argc, char **argv) | ... | @@ -86,7 +87,7 @@ main (int argc, char **argv) |
86 | 87 | ||
87 | if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) | 88 | if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) |
88 | { | 89 | { |
89 | fprintf (stderr, "could not open mbox: %s\n", strerror (status)); | 90 | fprintf (stderr, "could not open mbox: %s\n", mu_errstring (status)); |
90 | exit (1); | 91 | exit (1); |
91 | } | 92 | } |
92 | 93 | ||
... | @@ -102,7 +103,7 @@ main (int argc, char **argv) | ... | @@ -102,7 +103,7 @@ main (int argc, char **argv) |
102 | if ((status = mailbox_get_message (mbox, i, &msg)) != 0 || | 103 | if ((status = mailbox_get_message (mbox, i, &msg)) != 0 || |
103 | (status = message_get_header (msg, &hdr)) != 0) | 104 | (status = message_get_header (msg, &hdr)) != 0) |
104 | { | 105 | { |
105 | printf ("%s, msg %d: %s\n", mboxname, i, strerror (status)); | 106 | printf ("%s, msg %d: %s\n", mboxname, i, mu_errstring (status)); |
106 | continue; | 107 | continue; |
107 | } | 108 | } |
108 | if ((status = | 109 | if ((status = | ... | ... |
... | @@ -11,6 +11,7 @@ | ... | @@ -11,6 +11,7 @@ |
11 | #include <time.h> | 11 | #include <time.h> |
12 | #include <unistd.h> | 12 | #include <unistd.h> |
13 | 13 | ||
14 | #include <mailutils/errno.h> | ||
14 | #include <mailutils/mailbox.h> | 15 | #include <mailutils/mailbox.h> |
15 | #include <mailutils/registrar.h> | 16 | #include <mailutils/registrar.h> |
16 | 17 | ||
... | @@ -51,7 +52,7 @@ main (int argc, char **argv) | ... | @@ -51,7 +52,7 @@ main (int argc, char **argv) |
51 | if ((status = mailbox_create_default (&mbox, mbox_name)) != 0) | 52 | if ((status = mailbox_create_default (&mbox, mbox_name)) != 0) |
52 | { | 53 | { |
53 | fprintf (stderr, "could not create <%s>: %s\n", | 54 | fprintf (stderr, "could not create <%s>: %s\n", |
54 | mbox_name, strerror (status)); | 55 | mbox_name, mu_errstring (status)); |
55 | exit (1); | 56 | exit (1); |
56 | } | 57 | } |
57 | if(debug) | 58 | if(debug) |
... | @@ -64,7 +65,7 @@ main (int argc, char **argv) | ... | @@ -64,7 +65,7 @@ main (int argc, char **argv) |
64 | if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) | 65 | if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) |
65 | { | 66 | { |
66 | fprintf (stderr, "could not open <%s>: %s\n", | 67 | fprintf (stderr, "could not open <%s>: %s\n", |
67 | mbox_name, strerror (status)); | 68 | mbox_name, mu_errstring (status)); |
68 | exit (1); | 69 | exit (1); |
69 | } | 70 | } |
70 | mailbox_messages_count (mbox, &count); | 71 | mailbox_messages_count (mbox, &count); |
... | @@ -85,14 +86,14 @@ main (int argc, char **argv) | ... | @@ -85,14 +86,14 @@ main (int argc, char **argv) |
85 | if ((status = mailbox_get_message (mbox, msgno, &msg)) != 0) | 86 | if ((status = mailbox_get_message (mbox, msgno, &msg)) != 0) |
86 | { | 87 | { |
87 | fprintf (stderr, "msg %d: get message failed: %s\n", | 88 | fprintf (stderr, "msg %d: get message failed: %s\n", |
88 | msgno, strerror (status)); | 89 | msgno, mu_errstring (status)); |
89 | mailbox_close (mbox); | 90 | mailbox_close (mbox); |
90 | exit (1); | 91 | exit (1); |
91 | } | 92 | } |
92 | if ((status = message_get_num_parts (msg, &nparts))) | 93 | if ((status = message_get_num_parts (msg, &nparts))) |
93 | { | 94 | { |
94 | fprintf (stderr, "msg %d: get num parts failed: %s\n", | 95 | fprintf (stderr, "msg %d: get num parts failed: %s\n", |
95 | msgno, strerror (status)); | 96 | msgno, mu_errstring (status)); |
96 | mailbox_close (mbox); | 97 | mailbox_close (mbox); |
97 | exit (1); | 98 | exit (1); |
98 | } | 99 | } |
... | @@ -110,14 +111,14 @@ main (int argc, char **argv) | ... | @@ -110,14 +111,14 @@ main (int argc, char **argv) |
110 | if ((status = message_get_part (msg, partno, &part))) | 111 | if ((status = message_get_part (msg, partno, &part))) |
111 | { | 112 | { |
112 | fprintf (stderr, "msg %d: get part %d failed: %s\n", | 113 | fprintf (stderr, "msg %d: get part %d failed: %s\n", |
113 | msgno, partno, strerror (status)); | 114 | msgno, partno, mu_errstring (status)); |
114 | mailbox_close (mbox); | 115 | mailbox_close (mbox); |
115 | exit (1); | 116 | exit (1); |
116 | } | 117 | } |
117 | if ((status = message_save_attachment (part, path, 0))) | 118 | if ((status = message_save_attachment (part, path, 0))) |
118 | { | 119 | { |
119 | fprintf (stderr, "msg %d part %d: save failed: %s\n", | 120 | fprintf (stderr, "msg %d part %d: save failed: %s\n", |
120 | msgno, partno, strerror (status)); | 121 | msgno, partno, mu_errstring (status)); |
121 | break; | 122 | break; |
122 | } | 123 | } |
123 | } | 124 | } | ... | ... |
... | @@ -28,6 +28,7 @@ | ... | @@ -28,6 +28,7 @@ |
28 | 28 | ||
29 | #include <sys/types.h> | 29 | #include <sys/types.h> |
30 | 30 | ||
31 | #include <mailutils/errno.h> | ||
31 | #include <mailutils/mailbox.h> | 32 | #include <mailutils/mailbox.h> |
32 | #include <mailutils/header.h> | 33 | #include <mailutils/header.h> |
33 | #include <mailutils/filter.h> | 34 | #include <mailutils/filter.h> |
... | @@ -67,7 +68,7 @@ main (int argc, char **argv) | ... | @@ -67,7 +68,7 @@ main (int argc, char **argv) |
67 | 68 | ||
68 | if ((ret = mailbox_create_default (&mbox, mailbox_name)) != 0) | 69 | if ((ret = mailbox_create_default (&mbox, mailbox_name)) != 0) |
69 | { | 70 | { |
70 | fprintf (stderr, "could not create - %s\n", strerror (ret)); | 71 | fprintf (stderr, "could not create - %s\n", mu_errstring (ret)); |
71 | exit (2); | 72 | exit (2); |
72 | } | 73 | } |
73 | 74 | ||
... | @@ -82,7 +83,7 @@ main (int argc, char **argv) | ... | @@ -82,7 +83,7 @@ main (int argc, char **argv) |
82 | /* Open the mailbox for reading only. */ | 83 | /* Open the mailbox for reading only. */ |
83 | if ((ret = mailbox_open (mbox, MU_STREAM_RDWR)) != 0) | 84 | if ((ret = mailbox_open (mbox, MU_STREAM_RDWR)) != 0) |
84 | { | 85 | { |
85 | fprintf (stderr, "mailbox open - %s\n", strerror (ret)); | 86 | fprintf (stderr, "mailbox open - %s\n", mu_errstring (ret)); |
86 | exit (2); | 87 | exit (2); |
87 | } | 88 | } |
88 | 89 | ||
... | @@ -98,17 +99,17 @@ main (int argc, char **argv) | ... | @@ -98,17 +99,17 @@ main (int argc, char **argv) |
98 | 99 | ||
99 | if ((ret = mailbox_get_message (mbox, i, &msg)) != 0) | 100 | if ((ret = mailbox_get_message (mbox, i, &msg)) != 0) |
100 | { | 101 | { |
101 | fprintf (stderr, "mailbox_get_message - %s\n", strerror (ret)); | 102 | fprintf (stderr, "mailbox_get_message - %s\n", mu_errstring (ret)); |
102 | exit (2); | 103 | exit (2); |
103 | } | 104 | } |
104 | if ((ret = message_size (msg, &msize)) != 0) | 105 | if ((ret = message_size (msg, &msize)) != 0) |
105 | { | 106 | { |
106 | fprintf (stderr, "message_size - %s\n", strerror (ret)); | 107 | fprintf (stderr, "message_size - %s\n", mu_errstring (ret)); |
107 | exit (2); | 108 | exit (2); |
108 | } | 109 | } |
109 | if ((ret = message_get_header (msg, &hdr)) != 0) | 110 | if ((ret = message_get_header (msg, &hdr)) != 0) |
110 | { | 111 | { |
111 | fprintf (stderr, "message_get_header - %s\n", strerror (ret)); | 112 | fprintf (stderr, "message_get_header - %s\n", mu_errstring (ret)); |
112 | exit (2); | 113 | exit (2); |
113 | } | 114 | } |
114 | header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL); | 115 | header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL); |
... | @@ -120,7 +121,7 @@ main (int argc, char **argv) | ... | @@ -120,7 +121,7 @@ main (int argc, char **argv) |
120 | 121 | ||
121 | if ((ret = message_get_num_parts (msg, &nparts)) != 0) | 122 | if ((ret = message_get_num_parts (msg, &nparts)) != 0) |
122 | { | 123 | { |
123 | fprintf (stderr, "message_get_num_parts - %s\n", strerror (ret)); | 124 | fprintf (stderr, "message_get_num_parts - %s\n", mu_errstring (ret)); |
124 | exit (2); | 125 | exit (2); |
125 | } | 126 | } |
126 | printf ("-- Number of parts in message - %d\n", nparts); | 127 | printf ("-- Number of parts in message - %d\n", nparts); |
... | @@ -151,7 +152,7 @@ message_display_parts (message_t msg, const char *indent) | ... | @@ -151,7 +152,7 @@ message_display_parts (message_t msg, const char *indent) |
151 | /* How many parts does the message has? */ | 152 | /* How many parts does the message has? */ |
152 | if ((ret = message_get_num_parts (msg, &nparts)) != 0) | 153 | if ((ret = message_get_num_parts (msg, &nparts)) != 0) |
153 | { | 154 | { |
154 | fprintf (stderr, "message_get_num_parts - %s\n", strerror (ret)); | 155 | fprintf (stderr, "message_get_num_parts - %s\n", mu_errstring (ret)); |
155 | exit (2); | 156 | exit (2); |
156 | } | 157 | } |
157 | 158 | ||
... | @@ -162,17 +163,17 @@ message_display_parts (message_t msg, const char *indent) | ... | @@ -162,17 +163,17 @@ message_display_parts (message_t msg, const char *indent) |
162 | { | 163 | { |
163 | if ((ret = message_get_part (msg, j, &part)) != 0) | 164 | if ((ret = message_get_part (msg, j, &part)) != 0) |
164 | { | 165 | { |
165 | fprintf (stderr, "mime_get_part - %s\n", strerror (ret)); | 166 | fprintf (stderr, "mime_get_part - %s\n", mu_errstring (ret)); |
166 | exit (2); | 167 | exit (2); |
167 | } | 168 | } |
168 | if ((ret = message_size (part, &msize)) != 0) | 169 | if ((ret = message_size (part, &msize)) != 0) |
169 | { | 170 | { |
170 | fprintf (stderr, "message_size - %s\n", strerror (ret)); | 171 | fprintf (stderr, "message_size - %s\n", mu_errstring (ret)); |
171 | exit (2); | 172 | exit (2); |
172 | } | 173 | } |
173 | if ((ret = message_get_header (part, &hdr)) != 0) | 174 | if ((ret = message_get_header (part, &hdr)) != 0) |
174 | { | 175 | { |
175 | fprintf (stderr, "message_get_header - %s\n", strerror (ret)); | 176 | fprintf (stderr, "message_get_header - %s\n", mu_errstring (ret)); |
176 | exit (2); | 177 | exit (2); |
177 | } | 178 | } |
178 | header_get_value (hdr, MU_HEADER_CONTENT_TYPE, type, sizeof (type), | 179 | header_get_value (hdr, MU_HEADER_CONTENT_TYPE, type, sizeof (type), |
... | @@ -194,12 +195,12 @@ message_display_parts (message_t msg, const char *indent) | ... | @@ -194,12 +195,12 @@ message_display_parts (message_t msg, const char *indent) |
194 | ret = message_unencapsulate (part, &part, NULL); | 195 | ret = message_unencapsulate (part, &part, NULL); |
195 | if (ret != 0) | 196 | if (ret != 0) |
196 | fprintf (stderr, "message_unencapsulate - %s\n", | 197 | fprintf (stderr, "message_unencapsulate - %s\n", |
197 | strerror (ret)); | 198 | mu_errstring (ret)); |
198 | break; | 199 | break; |
199 | } | 200 | } |
200 | if ((ret = message_get_header (part, &hdr)) != 0) | 201 | if ((ret = message_get_header (part, &hdr)) != 0) |
201 | { | 202 | { |
202 | fprintf (stderr, "message_get_header - %s\n", strerror (ret)); | 203 | fprintf (stderr, "message_get_header - %s\n", mu_errstring (ret)); |
203 | exit (2); | 204 | exit (2); |
204 | } | 205 | } |
205 | header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL); | 206 | header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL); |
... | @@ -211,7 +212,7 @@ message_display_parts (message_t msg, const char *indent) | ... | @@ -211,7 +212,7 @@ message_display_parts (message_t msg, const char *indent) |
211 | indent); | 212 | indent); |
212 | if ((ret = message_get_num_parts (part, &nsubparts)) != 0) | 213 | if ((ret = message_get_num_parts (part, &nsubparts)) != 0) |
213 | { | 214 | { |
214 | fprintf (stderr, "mime_get_num_parts - %s\n", strerror (ret)); | 215 | fprintf (stderr, "mime_get_num_parts - %s\n", mu_errstring (ret)); |
215 | exit (2); | 216 | exit (2); |
216 | } | 217 | } |
217 | strcpy (tmp, indent); | 218 | strcpy (tmp, indent); | ... | ... |
... | @@ -8,13 +8,14 @@ | ... | @@ -8,13 +8,14 @@ |
8 | #include <unistd.h> | 8 | #include <unistd.h> |
9 | 9 | ||
10 | #include <mailutils/address.h> | 10 | #include <mailutils/address.h> |
11 | #include <mailutils/errno.h> | ||
11 | #include <mailutils/mailer.h> | 12 | #include <mailutils/mailer.h> |
12 | #include <mailutils/message.h> | 13 | #include <mailutils/message.h> |
13 | #include <mailutils/registrar.h> | 14 | #include <mailutils/registrar.h> |
14 | #include <mailutils/stream.h> | 15 | #include <mailutils/stream.h> |
15 | 16 | ||
16 | #define C(X) {int e; if((e = X) != 0) { \ | 17 | #define C(X) {int e; if((e = X) != 0) { \ |
17 | fprintf(stderr, "%s failed: %s\n", #X, strerror(e)); \ | 18 | fprintf(stderr, "%s failed: %s\n", #X, mu_errstring(e)); \ |
18 | exit(1); } } | 19 | exit(1); } } |
19 | 20 | ||
20 | const char USAGE[] = | 21 | const char USAGE[] = | ... | ... |
1 | #include <mailutils/errno.h> | ||
1 | #include <mailutils/url.h> | 2 | #include <mailutils/url.h> |
2 | #include <stdio.h> | 3 | #include <stdio.h> |
3 | #include <string.h> | 4 | #include <string.h> |
... | @@ -21,13 +22,13 @@ main () | ... | @@ -21,13 +22,13 @@ main () |
21 | if ((rc = url_create(&u, str)) != 0) | 22 | if ((rc = url_create(&u, str)) != 0) |
22 | { | 23 | { |
23 | fprintf(stderr, "url_create %s ERROR: [%d] %s", | 24 | fprintf(stderr, "url_create %s ERROR: [%d] %s", |
24 | str, rc, strerror(rc)); | 25 | str, rc, mu_errstring(rc)); |
25 | exit (1); | 26 | exit (1); |
26 | } | 27 | } |
27 | if ((rc = url_parse (u)) != 0) | 28 | if ((rc = url_parse (u)) != 0) |
28 | { | 29 | { |
29 | printf ("%s --> FAILED: [%d] %s\n", | 30 | printf ("%s --> FAILED: [%d] %s\n", |
30 | str, rc, strerror(rc)); | 31 | str, rc, mu_errstring(rc)); |
31 | continue; | 32 | continue; |
32 | } | 33 | } |
33 | printf ("%s --> SUCCESS\n", str); | 34 | printf ("%s --> SUCCESS\n", str); | ... | ... |
... | @@ -33,8 +33,9 @@ | ... | @@ -33,8 +33,9 @@ |
33 | #include <string.h> | 33 | #include <string.h> |
34 | #include <unistd.h> | 34 | #include <unistd.h> |
35 | 35 | ||
36 | #include <mailutils/mailbox.h> | ||
37 | #include <mailutils/address.h> | 36 | #include <mailutils/address.h> |
37 | #include <mailutils/errno.h> | ||
38 | #include <mailutils/mailbox.h> | ||
38 | #include <mailutils/registrar.h> | 39 | #include <mailutils/registrar.h> |
39 | 40 | ||
40 | int | 41 | int |
... | @@ -66,7 +67,7 @@ main(int argc, char **argv) | ... | @@ -66,7 +67,7 @@ main(int argc, char **argv) |
66 | 67 | ||
67 | if ((status = mailbox_create_default (&mbox, mailbox_name)) != 0) | 68 | if ((status = mailbox_create_default (&mbox, mailbox_name)) != 0) |
68 | { | 69 | { |
69 | fprintf (stderr, "could not create/open: %s\n", strerror (status)); | 70 | fprintf (stderr, "could not create/open: %s\n", mu_errstring (status)); |
70 | exit (1); | 71 | exit (1); |
71 | } | 72 | } |
72 | 73 | ||
... | @@ -79,7 +80,7 @@ main(int argc, char **argv) | ... | @@ -79,7 +80,7 @@ main(int argc, char **argv) |
79 | 80 | ||
80 | if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) | 81 | if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) |
81 | { | 82 | { |
82 | fprintf (stderr, "could not create/open: %s\n", strerror (status)); | 83 | fprintf (stderr, "could not create/open: %s\n", mu_errstring (status)); |
83 | exit (1); | 84 | exit (1); |
84 | } | 85 | } |
85 | 86 | ||
... | @@ -92,7 +93,7 @@ main(int argc, char **argv) | ... | @@ -92,7 +93,7 @@ main(int argc, char **argv) |
92 | if ((status = mailbox_get_message (mbox, i, &msg)) != 0 | 93 | if ((status = mailbox_get_message (mbox, i, &msg)) != 0 |
93 | || (status = message_get_header (msg, &hdr)) != 0) | 94 | || (status = message_get_header (msg, &hdr)) != 0) |
94 | { | 95 | { |
95 | fprintf (stderr, "msg %d : %s\n", i, strerror(status)); | 96 | fprintf (stderr, "msg %d : %s\n", i, mu_errstring(status)); |
96 | exit(2); | 97 | exit(2); |
97 | } | 98 | } |
98 | 99 | ... | ... |
... | @@ -39,7 +39,7 @@ collect_open_default () | ... | @@ -39,7 +39,7 @@ collect_open_default () |
39 | || mailbox_open (mbox, MU_STREAM_RDWR) != 0) | 39 | || mailbox_open (mbox, MU_STREAM_RDWR) != 0) |
40 | { | 40 | { |
41 | util_error ("can't open default mailbox %s: %s", | 41 | util_error ("can't open default mailbox %s: %s", |
42 | default_mailbox, strerror (errno)); | 42 | default_mailbox, mu_errstring (errno)); |
43 | exit (1); | 43 | exit (1); |
44 | } | 44 | } |
45 | 45 | ... | ... |
... | @@ -26,6 +26,7 @@ | ... | @@ -26,6 +26,7 @@ |
26 | #include <errno.h> | 26 | #include <errno.h> |
27 | #include <string.h> /* strerror(3), strdup(3) */ | 27 | #include <string.h> /* strerror(3), strdup(3) */ |
28 | 28 | ||
29 | #include <mailutils/errno.h> | ||
29 | #include <mailutils/mailbox.h> | 30 | #include <mailutils/mailbox.h> |
30 | #include <mailutils/message.h> | 31 | #include <mailutils/message.h> |
31 | #include <mailutils/header.h> | 32 | #include <mailutils/header.h> | ... | ... |
... | @@ -71,6 +71,7 @@ | ... | @@ -71,6 +71,7 @@ |
71 | 71 | ||
72 | #include <mailutils/address.h> | 72 | #include <mailutils/address.h> |
73 | #include <mailutils/body.h> | 73 | #include <mailutils/body.h> |
74 | #include <mailutils/errno.h> | ||
74 | #include <mailutils/error.h> | 75 | #include <mailutils/error.h> |
75 | #include <mailutils/filter.h> | 76 | #include <mailutils/filter.h> |
76 | #include <mailutils/folder.h> | 77 | #include <mailutils/folder.h> | ... | ... |
... | @@ -341,17 +341,17 @@ main (int argc, char **argv) | ... | @@ -341,17 +341,17 @@ main (int argc, char **argv) |
341 | /* open the mailbox */ | 341 | /* open the mailbox */ |
342 | if (args.file == NULL) | 342 | if (args.file == NULL) |
343 | { | 343 | { |
344 | if (mailbox_create_default (&mbox, args.user) != 0) | 344 | if ((rc = mailbox_create_default (&mbox, args.user)) != 0) |
345 | { | 345 | { |
346 | util_error ("Can not create mailbox for %s: %s", args.user, | 346 | util_error ("Can not create mailbox for %s: %s", args.user, |
347 | strerror (errno)); | 347 | mu_errstring (rc)); |
348 | exit (EXIT_FAILURE); | 348 | exit (EXIT_FAILURE); |
349 | } | 349 | } |
350 | } | 350 | } |
351 | else if (mailbox_create_default (&mbox, args.file) != 0) | 351 | else if ((rc = mailbox_create_default (&mbox, args.file)) != 0) |
352 | { | 352 | { |
353 | util_error ("Can not create mailbox %s: %s", args.file, | 353 | util_error ("Can not create mailbox %s: %s", args.file, |
354 | strerror (errno)); | 354 | mu_errstring (errno)); |
355 | exit (EXIT_FAILURE); | 355 | exit (EXIT_FAILURE); |
356 | } | 356 | } |
357 | 357 | ||
... | @@ -368,7 +368,7 @@ main (int argc, char **argv) | ... | @@ -368,7 +368,7 @@ main (int argc, char **argv) |
368 | url_t url = NULL; | 368 | url_t url = NULL; |
369 | mailbox_get_url (mbox, &url); | 369 | mailbox_get_url (mbox, &url); |
370 | util_error ("Can not open mailbox %s: %s", | 370 | util_error ("Can not open mailbox %s: %s", |
371 | url_to_string (url), strerror (rc)); | 371 | url_to_string (url), mu_errstring (rc)); |
372 | exit (EXIT_FAILURE); | 372 | exit (EXIT_FAILURE); |
373 | } | 373 | } |
374 | 374 | ... | ... |
... | @@ -52,6 +52,7 @@ | ... | @@ -52,6 +52,7 @@ |
52 | #include <readline/history.h> | 52 | #include <readline/history.h> |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | #include <mailutils/errno.h> | ||
55 | #include <mailutils/mailbox.h> | 56 | #include <mailutils/mailbox.h> |
56 | #include <mailutils/message.h> | 57 | #include <mailutils/message.h> |
57 | #include <mailutils/header.h> | 58 | #include <mailutils/header.h> | ... | ... |
... | @@ -33,7 +33,9 @@ | ... | @@ -33,7 +33,9 @@ |
33 | #include "md5-rsa.h" | 33 | #include "md5-rsa.h" |
34 | 34 | ||
35 | #include <message0.h> | 35 | #include <message0.h> |
36 | |||
36 | #include <mailutils/address.h> | 37 | #include <mailutils/address.h> |
38 | #include <mailutils/errno.h> | ||
37 | #include <mailutils/mutil.h> | 39 | #include <mailutils/mutil.h> |
38 | 40 | ||
39 | #define MESSAGE_MODIFIED 0x10000; | 41 | #define MESSAGE_MODIFIED 0x10000; |
... | @@ -1017,7 +1019,7 @@ message_save_to_mailbox (message_t msg, ticket_t ticket, mu_debug_t debug, | ... | @@ -1017,7 +1019,7 @@ message_save_to_mailbox (message_t msg, ticket_t ticket, mu_debug_t debug, |
1017 | { | 1019 | { |
1018 | mu_debug_print (debug, MU_DEBUG_TRACE, | 1020 | mu_debug_print (debug, MU_DEBUG_TRACE, |
1019 | "mailbox_create_default (%s) failed: %s\n", toname, | 1021 | "mailbox_create_default (%s) failed: %s\n", toname, |
1020 | strerror (rc)); | 1022 | mu_errstring (rc)); |
1021 | goto end; | 1023 | goto end; |
1022 | } | 1024 | } |
1023 | 1025 | ||
... | @@ -1048,7 +1050,7 @@ message_save_to_mailbox (message_t msg, ticket_t ticket, mu_debug_t debug, | ... | @@ -1048,7 +1050,7 @@ message_save_to_mailbox (message_t msg, ticket_t ticket, mu_debug_t debug, |
1048 | { | 1050 | { |
1049 | mu_debug_print (debug, MU_DEBUG_TRACE, | 1051 | mu_debug_print (debug, MU_DEBUG_TRACE, |
1050 | "mailbox_open (%s) failed: %s\n", toname, | 1052 | "mailbox_open (%s) failed: %s\n", toname, |
1051 | strerror (rc)); | 1053 | mu_errstring (rc)); |
1052 | goto end; | 1054 | goto end; |
1053 | } | 1055 | } |
1054 | 1056 | ||
... | @@ -1056,7 +1058,7 @@ message_save_to_mailbox (message_t msg, ticket_t ticket, mu_debug_t debug, | ... | @@ -1056,7 +1058,7 @@ message_save_to_mailbox (message_t msg, ticket_t ticket, mu_debug_t debug, |
1056 | { | 1058 | { |
1057 | mu_debug_print (debug, MU_DEBUG_TRACE, | 1059 | mu_debug_print (debug, MU_DEBUG_TRACE, |
1058 | "mailbox_append_message (%s) failed: %s\n", toname, | 1060 | "mailbox_append_message (%s) failed: %s\n", toname, |
1059 | strerror (rc)); | 1061 | mu_errstring (rc)); |
1060 | goto end; | 1062 | goto end; |
1061 | } | 1063 | } |
1062 | 1064 | ||
... | @@ -1068,7 +1070,7 @@ end: | ... | @@ -1068,7 +1070,7 @@ end: |
1068 | { | 1070 | { |
1069 | mu_debug_print (debug, MU_DEBUG_TRACE, | 1071 | mu_debug_print (debug, MU_DEBUG_TRACE, |
1070 | "mailbox_close (%s) failed: %s\n", toname, | 1072 | "mailbox_close (%s) failed: %s\n", toname, |
1071 | strerror (rc)); | 1073 | mu_errstring (rc)); |
1072 | } | 1074 | } |
1073 | } | 1075 | } |
1074 | else | 1076 | else | ... | ... |
... | @@ -28,7 +28,9 @@ | ... | @@ -28,7 +28,9 @@ |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #include <ctype.h> | 29 | #include <ctype.h> |
30 | 30 | ||
31 | #include <mailutils/errno.h> | ||
31 | #include <mailutils/mutil.h> | 32 | #include <mailutils/mutil.h> |
33 | |||
32 | #include <auth0.h> | 34 | #include <auth0.h> |
33 | #include <url0.h> | 35 | #include <url0.h> |
34 | 36 | ||
... | @@ -324,7 +326,7 @@ get_ticket (url_t url, const char *user, const char *filename, url_t * ticket) | ... | @@ -324,7 +326,7 @@ get_ticket (url_t url, const char *user, const char *filename, url_t * ticket) |
324 | { | 326 | { |
325 | /* TODO: send output to the debug stream */ | 327 | /* TODO: send output to the debug stream */ |
326 | /* | 328 | /* |
327 | printf ("url_parse %s failed: [%d] %s\n", str, err, strerror (err)); | 329 | printf ("url_parse %s failed: [%d] %s\n", str, err, mu_errstring (err)); |
328 | */ | 330 | */ |
329 | url_destroy (&u); | 331 | url_destroy (&u); |
330 | continue; | 332 | continue; | ... | ... |
... | @@ -61,7 +61,7 @@ pop3d_apopuser (const char *user) | ... | @@ -61,7 +61,7 @@ pop3d_apopuser (const char *user) |
61 | syslog (LOG_INFO, "Bad permissions on APOP password db"); | 61 | syslog (LOG_INFO, "Bad permissions on APOP password db"); |
62 | else | 62 | else |
63 | syslog (LOG_ERR, "Unable to open APOP db: %s", | 63 | syslog (LOG_ERR, "Unable to open APOP db: %s", |
64 | strerror (rc)); | 64 | mu_errstring (rc)); |
65 | return NULL; | 65 | return NULL; |
66 | } | 66 | } |
67 | 67 | ||
... | @@ -78,7 +78,7 @@ pop3d_apopuser (const char *user) | ... | @@ -78,7 +78,7 @@ pop3d_apopuser (const char *user) |
78 | mu_dbm_close (db); | 78 | mu_dbm_close (db); |
79 | if (rc) | 79 | if (rc) |
80 | { | 80 | { |
81 | syslog (LOG_ERR, "Can't fetch APOP data: %s", strerror (rc)); | 81 | syslog (LOG_ERR, "Can't fetch APOP data: %s", mu_errstring (rc)); |
82 | return NULL; | 82 | return NULL; |
83 | } | 83 | } |
84 | password = calloc (MU_DATUM_SIZE(data) + 1, sizeof (*password)); | 84 | password = calloc (MU_DATUM_SIZE(data) + 1, sizeof (*password)); | ... | ... |
... | @@ -109,6 +109,7 @@ | ... | @@ -109,6 +109,7 @@ |
109 | # include <strings.h> | 109 | # include <strings.h> |
110 | #endif | 110 | #endif |
111 | 111 | ||
112 | #include <mailutils/errno.h> | ||
112 | #include <mailutils/mailbox.h> | 113 | #include <mailutils/mailbox.h> |
113 | #include <mailutils/message.h> | 114 | #include <mailutils/message.h> |
114 | #include <mailutils/header.h> | 115 | #include <mailutils/header.h> | ... | ... |
... | @@ -248,7 +248,7 @@ main (int argc, char **argv) | ... | @@ -248,7 +248,7 @@ main (int argc, char **argv) |
248 | status = mailbox_create_default (&mbox, mailbox_name); | 248 | status = mailbox_create_default (&mbox, mailbox_name); |
249 | if (status != 0) | 249 | if (status != 0) |
250 | { | 250 | { |
251 | fprintf (stderr, "could not create - %s\n", strerror(status)); | 251 | fprintf (stderr, "could not create - %s\n", mu_errstring(status)); |
252 | exit (2); | 252 | exit (2); |
253 | } | 253 | } |
254 | 254 | ||
... | @@ -263,7 +263,7 @@ main (int argc, char **argv) | ... | @@ -263,7 +263,7 @@ main (int argc, char **argv) |
263 | status = mailbox_open (mbox, MU_STREAM_READ); | 263 | status = mailbox_open (mbox, MU_STREAM_READ); |
264 | if (status != 0) | 264 | if (status != 0) |
265 | { | 265 | { |
266 | fprintf (stderr, "mailbox open - %s\n", strerror(status)); | 266 | fprintf (stderr, "mailbox open - %s\n", mu_errstring(status)); |
267 | exit (2); | 267 | exit (2); |
268 | } | 268 | } |
269 | 269 | ||
... | @@ -282,7 +282,7 @@ main (int argc, char **argv) | ... | @@ -282,7 +282,7 @@ main (int argc, char **argv) |
282 | status = mailbox_get_message (mbox, set[i], &msg); | 282 | status = mailbox_get_message (mbox, set[i], &msg); |
283 | if (status != 0) | 283 | if (status != 0) |
284 | { | 284 | { |
285 | fprintf (stderr, "mailbox_get_message - %s\n", strerror (status)); | 285 | fprintf (stderr, "mailbox_get_message - %s\n", mu_errstring (status)); |
286 | exit (2); | 286 | exit (2); |
287 | } | 287 | } |
288 | 288 | ... | ... |
... | @@ -28,6 +28,7 @@ | ... | @@ -28,6 +28,7 @@ |
28 | #include <errno.h> | 28 | #include <errno.h> |
29 | #include <getopt.h> | 29 | #include <getopt.h> |
30 | 30 | ||
31 | #include <mailutils/errno.h> | ||
31 | #include <mailutils/mailbox.h> | 32 | #include <mailutils/mailbox.h> |
32 | #include <mailutils/header.h> | 33 | #include <mailutils/header.h> |
33 | #include <mailutils/mime.h> | 34 | #include <mailutils/mime.h> | ... | ... |
... | @@ -24,6 +24,7 @@ sieve script interpreter. | ... | @@ -24,6 +24,7 @@ sieve script interpreter. |
24 | 24 | ||
25 | #include "sieve.h" | 25 | #include "sieve.h" |
26 | 26 | ||
27 | #include <mailutils/errno.h> | ||
27 | #include <mailutils/mailbox.h> | 28 | #include <mailutils/mailbox.h> |
28 | #include <mailutils/mutil.h> | 29 | #include <mailutils/mutil.h> |
29 | #include <mailutils/registrar.h> | 30 | #include <mailutils/registrar.h> |
... | @@ -188,10 +189,10 @@ execute_error (const char *script, message_t msg, int rc, const char *errmsg) | ... | @@ -188,10 +189,10 @@ execute_error (const char *script, message_t msg, int rc, const char *errmsg) |
188 | message_get_uid (msg, &uid); | 189 | message_get_uid (msg, &uid); |
189 | 190 | ||
190 | if (rc) | 191 | if (rc) |
191 | fprintf (stderr, "%s on msg uid %d failed: %s\n", script, uid, errmsg); | ||
192 | else | ||
193 | fprintf (stderr, "%s on msg uid %d failed: %s (%s)\n", script, uid, | 192 | fprintf (stderr, "%s on msg uid %d failed: %s (%s)\n", script, uid, |
194 | errmsg, strerror (rc)); | 193 | errmsg, mu_errstring (rc)); |
194 | else | ||
195 | fprintf (stderr, "%s on msg uid %d failed: %s\n", script, uid, errmsg); | ||
195 | } | 196 | } |
196 | 197 | ||
197 | static void | 198 | static void |
... | @@ -343,12 +344,12 @@ main (int argc, char *argv[]) | ... | @@ -343,12 +344,12 @@ main (int argc, char *argv[]) |
343 | if ((rc = wicket_create (&wicket, opts.tickets)) != 0) | 344 | if ((rc = wicket_create (&wicket, opts.tickets)) != 0) |
344 | { | 345 | { |
345 | fprintf (stderr, "wicket create <%s> failed: %s\n", | 346 | fprintf (stderr, "wicket create <%s> failed: %s\n", |
346 | opts.tickets, strerror (rc)); | 347 | opts.tickets, mu_errstring (rc)); |
347 | goto cleanup; | 348 | goto cleanup; |
348 | } | 349 | } |
349 | if ((rc = wicket_get_ticket (wicket, &ticket, 0, 0)) != 0) | 350 | if ((rc = wicket_get_ticket (wicket, &ticket, 0, 0)) != 0) |
350 | { | 351 | { |
351 | fprintf (stderr, "ticket get failed: %s\n", strerror (rc)); | 352 | fprintf (stderr, "ticket get failed: %s\n", mu_errstring (rc)); |
352 | goto cleanup; | 353 | goto cleanup; |
353 | } | 354 | } |
354 | } | 355 | } |
... | @@ -358,17 +359,17 @@ main (int argc, char *argv[]) | ... | @@ -358,17 +359,17 @@ main (int argc, char *argv[]) |
358 | { | 359 | { |
359 | if ((rc = mu_debug_create (&debug, interp))) | 360 | if ((rc = mu_debug_create (&debug, interp))) |
360 | { | 361 | { |
361 | fprintf (stderr, "mu_debug_create failed: %s\n", strerror (rc)); | 362 | fprintf (stderr, "mu_debug_create failed: %s\n", mu_errstring (rc)); |
362 | goto cleanup; | 363 | goto cleanup; |
363 | } | 364 | } |
364 | if ((rc = mu_debug_set_level (debug, opts.debug_level))) | 365 | if ((rc = mu_debug_set_level (debug, opts.debug_level))) |
365 | { | 366 | { |
366 | fprintf (stderr, "mu_debug_set_level failed: %s\n", strerror (rc)); | 367 | fprintf (stderr, "mu_debug_set_level failed: %s\n", mu_errstring (rc)); |
367 | goto cleanup; | 368 | goto cleanup; |
368 | } | 369 | } |
369 | if ((rc = mu_debug_set_print (debug, debug_print, interp))) | 370 | if ((rc = mu_debug_set_print (debug, debug_print, interp))) |
370 | { | 371 | { |
371 | fprintf (stderr, "mu_debug_set_print failed: %s\n", strerror (rc)); | 372 | fprintf (stderr, "mu_debug_set_print failed: %s\n", mu_errstring (rc)); |
372 | goto cleanup; | 373 | goto cleanup; |
373 | } | 374 | } |
374 | } | 375 | } |
... | @@ -377,12 +378,12 @@ main (int argc, char *argv[]) | ... | @@ -377,12 +378,12 @@ main (int argc, char *argv[]) |
377 | if ((rc = mailer_create(&mailer, opts.mailer))) | 378 | if ((rc = mailer_create(&mailer, opts.mailer))) |
378 | { | 379 | { |
379 | fprintf (stderr, "mailer create <%s> failed: %s\n", | 380 | fprintf (stderr, "mailer create <%s> failed: %s\n", |
380 | opts.mailer, strerror (rc)); | 381 | opts.mailer, mu_errstring (rc)); |
381 | goto cleanup; | 382 | goto cleanup; |
382 | } | 383 | } |
383 | if (debug && (rc = mailer_set_debug (mailer, debug))) | 384 | if (debug && (rc = mailer_set_debug (mailer, debug))) |
384 | { | 385 | { |
385 | fprintf (stderr, "mailer_set_debug failed: %s\n", strerror (rc)); | 386 | fprintf (stderr, "mailer_set_debug failed: %s\n", mu_errstring (rc)); |
386 | goto cleanup; | 387 | goto cleanup; |
387 | } | 388 | } |
388 | 389 | ||
... | @@ -390,13 +391,13 @@ main (int argc, char *argv[]) | ... | @@ -390,13 +391,13 @@ main (int argc, char *argv[]) |
390 | if ((rc = mailbox_create_default (&mbox, opts.mbox)) != 0) | 391 | if ((rc = mailbox_create_default (&mbox, opts.mbox)) != 0) |
391 | { | 392 | { |
392 | fprintf (stderr, "mailbox create <%s> failed: %s\n", | 393 | fprintf (stderr, "mailbox create <%s> failed: %s\n", |
393 | opts.mbox ? opts.mbox : "default", strerror (rc)); | 394 | opts.mbox ? opts.mbox : "default", mu_errstring (rc)); |
394 | goto cleanup; | 395 | goto cleanup; |
395 | } | 396 | } |
396 | 397 | ||
397 | if (debug && (rc = mailbox_set_debug (mbox, debug))) | 398 | if (debug && (rc = mailbox_set_debug (mbox, debug))) |
398 | { | 399 | { |
399 | fprintf (stderr, "mailbox_set_debug failed: %s\n", strerror (rc)); | 400 | fprintf (stderr, "mailbox_set_debug failed: %s\n", mu_errstring (rc)); |
400 | goto cleanup; | 401 | goto cleanup; |
401 | } | 402 | } |
402 | 403 | ||
... | @@ -407,20 +408,20 @@ main (int argc, char *argv[]) | ... | @@ -407,20 +408,20 @@ main (int argc, char *argv[]) |
407 | 408 | ||
408 | if ((rc = mailbox_get_folder (mbox, &folder))) | 409 | if ((rc = mailbox_get_folder (mbox, &folder))) |
409 | { | 410 | { |
410 | fprintf (stderr, "mailbox_get_folder failed: %s", strerror (rc)); | 411 | fprintf (stderr, "mailbox_get_folder failed: %s", mu_errstring (rc)); |
411 | goto cleanup; | 412 | goto cleanup; |
412 | } | 413 | } |
413 | 414 | ||
414 | if ((rc = folder_get_authority (folder, &auth))) | 415 | if ((rc = folder_get_authority (folder, &auth))) |
415 | { | 416 | { |
416 | fprintf (stderr, "folder_get_authority failed: %s", strerror (rc)); | 417 | fprintf (stderr, "folder_get_authority failed: %s", mu_errstring (rc)); |
417 | goto cleanup; | 418 | goto cleanup; |
418 | } | 419 | } |
419 | 420 | ||
420 | /* Authentication-less folders don't have authorities. */ | 421 | /* Authentication-less folders don't have authorities. */ |
421 | if (auth && (rc = authority_set_ticket (auth, ticket))) | 422 | if (auth && (rc = authority_set_ticket (auth, ticket))) |
422 | { | 423 | { |
423 | fprintf (stderr, "authority_set_ticket failed: %s", strerror (rc)); | 424 | fprintf (stderr, "authority_set_ticket failed: %s", mu_errstring (rc)); |
424 | goto cleanup; | 425 | goto cleanup; |
425 | } | 426 | } |
426 | } | 427 | } |
... | @@ -434,7 +435,7 @@ main (int argc, char *argv[]) | ... | @@ -434,7 +435,7 @@ main (int argc, char *argv[]) |
434 | if (rc != 0) | 435 | if (rc != 0) |
435 | { | 436 | { |
436 | fprintf (stderr, "open on %s failed: %s\n", | 437 | fprintf (stderr, "open on %s failed: %s\n", |
437 | opts.mbox ? opts.mbox : "default", strerror (rc)); | 438 | opts.mbox ? opts.mbox : "default", mu_errstring (rc)); |
438 | goto cleanup; | 439 | goto cleanup; |
439 | } | 440 | } |
440 | 441 | ||
... | @@ -444,7 +445,7 @@ main (int argc, char *argv[]) | ... | @@ -444,7 +445,7 @@ main (int argc, char *argv[]) |
444 | if (rc != 0) | 445 | if (rc != 0) |
445 | { | 446 | { |
446 | fprintf (stderr, "message count on %s failed: %s\n", | 447 | fprintf (stderr, "message count on %s failed: %s\n", |
447 | opts.mbox ? opts.mbox : "default", strerror (rc)); | 448 | opts.mbox ? opts.mbox : "default", mu_errstring (rc)); |
448 | goto cleanup; | 449 | goto cleanup; |
449 | } | 450 | } |
450 | 451 | ||
... | @@ -455,7 +456,7 @@ main (int argc, char *argv[]) | ... | @@ -455,7 +456,7 @@ main (int argc, char *argv[]) |
455 | if ((rc = mailbox_get_message (mbox, msgno, &msg)) != 0) | 456 | if ((rc = mailbox_get_message (mbox, msgno, &msg)) != 0) |
456 | { | 457 | { |
457 | fprintf (stderr, "get message on %s (msg %d) failed: %s\n", | 458 | fprintf (stderr, "get message on %s (msg %d) failed: %s\n", |
458 | opts.mbox ? opts.mbox : "default", msgno, strerror (rc)); | 459 | opts.mbox ? opts.mbox : "default", msgno, mu_errstring (rc)); |
459 | goto cleanup; | 460 | goto cleanup; |
460 | } | 461 | } |
461 | 462 | ||
... | @@ -484,7 +485,7 @@ cleanup: | ... | @@ -484,7 +485,7 @@ cleanup: |
484 | on a later message. */ | 485 | on a later message. */ |
485 | if ((e = mailbox_expunge (mbox)) != 0) | 486 | if ((e = mailbox_expunge (mbox)) != 0) |
486 | fprintf (stderr, "expunge on %s failed: %s\n", | 487 | fprintf (stderr, "expunge on %s failed: %s\n", |
487 | opts.mbox ? opts.mbox : "default", strerror (e)); | 488 | opts.mbox ? opts.mbox : "default", mu_errstring (e)); |
488 | 489 | ||
489 | if(e && !rc) | 490 | if(e && !rc) |
490 | rc = e; | 491 | rc = e; | ... | ... |
1 | #ifndef SV_H | 1 | #ifndef SV_H |
2 | #define SV_H | 2 | #define SV_H |
3 | 3 | ||
4 | #include <mailutils/errno.h> | ||
4 | #include <mailutils/mailbox.h> | 5 | #include <mailutils/mailbox.h> |
5 | #include <mailutils/address.h> | 6 | #include <mailutils/address.h> |
6 | #include <mailutils/registrar.h> | 7 | #include <mailutils/registrar.h> | ... | ... |
... | @@ -4,6 +4,7 @@ | ... | @@ -4,6 +4,7 @@ |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <string.h> | 5 | #include <string.h> |
6 | 6 | ||
7 | #include <mailutils/errno.h> | ||
7 | #include <mailutils/envelope.h> | 8 | #include <mailutils/envelope.h> |
8 | 9 | ||
9 | #include "sv.h" | 10 | #include "sv.h" |
... | @@ -247,7 +248,7 @@ sv_redirect (void *ac, void *ic, void *sc, void *mc, const char **errmsg) | ... | @@ -247,7 +248,7 @@ sv_redirect (void *ac, void *ic, void *sc, void *mc, const char **errmsg) |
247 | { | 248 | { |
248 | mu_debug_print (m->debug, MU_DEBUG_ERROR, | 249 | mu_debug_print (m->debug, MU_DEBUG_ERROR, |
249 | "redirect - parsing to '%s' failed: [%d] %s\n", | 250 | "redirect - parsing to '%s' failed: [%d] %s\n", |
250 | a->addr, m->rc, strerror (m->rc)); | 251 | a->addr, m->rc, mu_errstring (m->rc)); |
251 | goto end; | 252 | goto end; |
252 | } | 253 | } |
253 | 254 | ||
... | @@ -273,7 +274,7 @@ sv_redirect (void *ac, void *ic, void *sc, void *mc, const char **errmsg) | ... | @@ -273,7 +274,7 @@ sv_redirect (void *ac, void *ic, void *sc, void *mc, const char **errmsg) |
273 | { | 274 | { |
274 | mu_debug_print (m->debug, MU_DEBUG_ERROR, | 275 | mu_debug_print (m->debug, MU_DEBUG_ERROR, |
275 | "redirect - parsing from '%s' failed: [%d] %s\n", | 276 | "redirect - parsing from '%s' failed: [%d] %s\n", |
276 | a->addr, m->rc, strerror (m->rc)); | 277 | a->addr, m->rc, mu_errstring (m->rc)); |
277 | goto end; | 278 | goto end; |
278 | } | 279 | } |
279 | 280 | ||
... | @@ -281,7 +282,7 @@ sv_redirect (void *ac, void *ic, void *sc, void *mc, const char **errmsg) | ... | @@ -281,7 +282,7 @@ sv_redirect (void *ac, void *ic, void *sc, void *mc, const char **errmsg) |
281 | { | 282 | { |
282 | mu_debug_print (m->debug, MU_DEBUG_ERROR, | 283 | mu_debug_print (m->debug, MU_DEBUG_ERROR, |
283 | "redirect - opening mailer '%s' failed: [%d] %s\n", | 284 | "redirect - opening mailer '%s' failed: [%d] %s\n", |
284 | m->mailer, m->rc, strerror (m->rc)); | 285 | m->mailer, m->rc, mu_errstring (m->rc)); |
285 | goto end; | 286 | goto end; |
286 | } | 287 | } |
287 | 288 | ||
... | @@ -289,7 +290,7 @@ sv_redirect (void *ac, void *ic, void *sc, void *mc, const char **errmsg) | ... | @@ -289,7 +290,7 @@ sv_redirect (void *ac, void *ic, void *sc, void *mc, const char **errmsg) |
289 | { | 290 | { |
290 | mu_debug_print (m->debug, MU_DEBUG_ERROR, | 291 | mu_debug_print (m->debug, MU_DEBUG_ERROR, |
291 | "redirect - send from '%s' to '%s' failed: [%d] %s\n", | 292 | "redirect - send from '%s' to '%s' failed: [%d] %s\n", |
292 | fromaddr, a->addr, m->rc, strerror (m->rc)); | 293 | fromaddr, a->addr, m->rc, mu_errstring (m->rc)); |
293 | goto end; | 294 | goto end; |
294 | } | 295 | } |
295 | 296 | ||
... | @@ -319,7 +320,7 @@ sv_discard (void *ac, void *ic, void *sc, void *mc, const char **errmsg) | ... | @@ -319,7 +320,7 @@ sv_discard (void *ac, void *ic, void *sc, void *mc, const char **errmsg) |
319 | m->rc = sv_mu_mark_deleted (m->msg, 1); | 320 | m->rc = sv_mu_mark_deleted (m->msg, 1); |
320 | mu_debug_print (m->debug, MU_DEBUG_ERROR, | 321 | mu_debug_print (m->debug, MU_DEBUG_ERROR, |
321 | "discard - deleting failed: [%d] %s\n", | 322 | "discard - deleting failed: [%d] %s\n", |
322 | m->rc, strerror (m->rc)); | 323 | m->rc, mu_errstring (m->rc)); |
323 | } | 324 | } |
324 | 325 | ||
325 | return sieve_err (m->rc); | 326 | return sieve_err (m->rc); | ... | ... |
-
Please register or sign in to post a comment