diff options
-rw-r--r-- | comsat/comsat.c | 14 | ||||
-rw-r--r-- | comsat/comsat.h | 1 | ||||
-rw-r--r-- | examples/Makefile | 2 | ||||
-rw-r--r-- | examples/addr.c | 31 | ||||
-rw-r--r-- | examples/mbox-check.c | 11 | ||||
-rw-r--r-- | examples/mbox-dates.c | 11 | ||||
-rw-r--r-- | examples/mbox-explode.c | 13 | ||||
-rw-r--r-- | examples/mimetest.c | 27 | ||||
-rw-r--r-- | examples/msg-send.c | 3 | ||||
-rw-r--r-- | examples/url-parse.c | 5 | ||||
-rw-r--r-- | from/from.c | 9 | ||||
-rw-r--r-- | guimb/collect.c | 2 | ||||
-rw-r--r-- | guimb/guimb.h | 1 | ||||
-rw-r--r-- | imap4d/imap4d.h | 1 | ||||
-rw-r--r-- | mail/mail.c | 10 | ||||
-rw-r--r-- | mail/mail.h | 1 | ||||
-rw-r--r-- | mailbox/message.c | 10 | ||||
-rw-r--r-- | mailbox/wicket.c | 4 | ||||
-rw-r--r-- | pop3d/apop.c | 4 | ||||
-rw-r--r-- | pop3d/pop3d.h | 1 | ||||
-rw-r--r-- | readmsg/readmsg.c | 6 | ||||
-rw-r--r-- | readmsg/readmsg.h | 1 | ||||
-rw-r--r-- | sieve/sieve.c | 39 | ||||
-rw-r--r-- | sieve/sv.h | 1 | ||||
-rw-r--r-- | sieve/svcb.c | 11 | ||||
-rw-r--r-- | sieve/svctx.c | 2 |
26 files changed, 106 insertions, 115 deletions
diff --git a/comsat/comsat.c b/comsat/comsat.c index f0a474ab2..e6cdcc5e7 100644 --- a/comsat/comsat.c +++ b/comsat/comsat.c @@ -435,21 +435,21 @@ notify_user (const char *user, const char *device, const char *path, off_t offse || (status = mailbox_open (mbox, MU_STREAM_READ)) != 0) { syslog (LOG_ERR, "can't open mailbox %s: %s", - path, strerror (status)); + path, mu_errstring (status)); return; } if ((status = mailbox_get_stream (mbox, &stream))) { syslog (LOG_ERR, "can't get stream for mailbox %s: %s", - path, strerror (status)); + path, mu_errstring (status)); return; } if ((status = stream_size (stream, (off_t *) &size))) { syslog (LOG_ERR, "can't get stream size (mailbox %s): %s", - path, strerror (status)); + path, mu_errstring (status)); return; } @@ -462,18 +462,18 @@ notify_user (const char *user, const char *device, const char *path, off_t offse stream_read (stream, blurb, size, offset, &n); blurb[size] = 0; - if (mailbox_create (&tmp, "/dev/null") != 0 - || mailbox_open (tmp, MU_STREAM_READ) != 0) + if ((status = mailbox_create (&tmp, "/dev/null")) != 0 + || (status = mailbox_open (tmp, MU_STREAM_READ)) != 0) { syslog (LOG_ERR, "can't create temporary mailbox: %s", - strerror (status)); + mu_errstring (status)); return; } if ((status = memory_stream_create (&stream, 0, 0))) { syslog (LOG_ERR, "can't create temporary stream: %s", - strerror (status)); + mu_errstring (status)); return; } diff --git a/comsat/comsat.h b/comsat/comsat.h index ab61045e3..865aa8985 100644 --- a/comsat/comsat.h +++ b/comsat/comsat.h @@ -54,6 +54,7 @@ #include <mailutils/stream.h> #include <mailutils/mutil.h> #include <mailutils/error.h> +#include <mailutils/errno.h> #include <argcv.h> #include <mu_argp.h> diff --git a/examples/Makefile b/examples/Makefile index 9d5d7f425..7d673f781 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -7,7 +7,7 @@ LDLIBS = -lsocket # On GNU/Linux (if compile with threads) #LDLIBS = -lpthread -MULIBS = ../mailbox/.libs/libmailbox.a ../lib/libmailutils.a +MULIBS = ../mailbox/.libs/libmailbox.a ../lib/.libs/libmailutils.a EXES = addr mbox-explode mbox-dates mbox-auth url-parse mbox-check mimetest msg-send diff --git a/examples/addr.c b/examples/addr.c index 60b92be8d..0832a5032 100644 --- a/examples/addr.c +++ b/examples/addr.c @@ -4,35 +4,6 @@ #define EPARSE ENOENT -static const char * -err_name (int e) -{ - struct - { - int e; - const char *s; - } - map[] = - { -#define E(e) { e, #e }, - E (EPARSE) E (EINVAL) E (ENOMEM) -#undef E - { - 0, NULL} - }; - static char s[sizeof (int) * 8 + 3]; - int i; - - for (i = 0; map[i].s; i++) - { - if (map[i].e == e) - return map[i].s; - } - sprintf (s, "[%d]", e); - - return s; -} - static int parse (const char *str) { @@ -50,7 +21,7 @@ parse (const char *str) if (status) { - printf ("%s=> error %s\n\n", str, err_name (status)); + printf ("%s=> error %s\n\n", str, mu_errname (status)); return 0; } else diff --git a/examples/mbox-check.c b/examples/mbox-check.c index e1769e6ab..47ffd1a0a 100644 --- a/examples/mbox-check.c +++ b/examples/mbox-check.c @@ -10,10 +10,11 @@ #include <time.h> #include <unistd.h> -#include <mailutils/mailbox.h> #include <mailutils/address.h> -#include <mailutils/registrar.h> +#include <mailutils/errno.h> +#include <mailutils/mailbox.h> #include <mailutils/parse822.h> +#include <mailutils/registrar.h> int main (int argc, char **argv) @@ -35,7 +36,7 @@ main (int argc, char **argv) if ((status = mailbox_create_default (&mbox, mboxname)) != 0) { fprintf (stderr, "could not create <%s>: %s\n", - mboxname, strerror (status)); + mboxname, mu_errstring (status)); return status; } @@ -48,7 +49,7 @@ main (int argc, char **argv) if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) { fprintf (stderr, "could not open <%s>: %s\n", - mboxname, strerror (status)); + mboxname, mu_errstring (status)); mailbox_destroy (&mbox); exit (1); } @@ -56,7 +57,7 @@ main (int argc, char **argv) if ((status = mailbox_messages_count (mbox, &count)) != 0) { fprintf (stderr, "could not count <%s>: %s\n", - mboxname, strerror (status)); + mboxname, mu_errstring (status)); mailbox_close (mbox); mailbox_destroy (&mbox); exit (1); diff --git a/examples/mbox-dates.c b/examples/mbox-dates.c index 09d8f97b2..1a1deebb5 100644 --- a/examples/mbox-dates.c +++ b/examples/mbox-dates.c @@ -10,10 +10,11 @@ #include <time.h> #include <unistd.h> -#include <mailutils/mailbox.h> #include <mailutils/address.h> -#include <mailutils/registrar.h> +#include <mailutils/errno.h> +#include <mailutils/mailbox.h> #include <mailutils/parse822.h> +#include <mailutils/registrar.h> static const char * @@ -73,7 +74,7 @@ main (int argc, char **argv) if ((status = mailbox_create_default (&mbox, mboxname)) != 0) { fprintf (stderr, "could not create <%s>: %s\n", - mboxname, strerror (status)); + mboxname, mu_errstring (status)); exit (1); } @@ -86,7 +87,7 @@ main (int argc, char **argv) if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) { - fprintf (stderr, "could not open mbox: %s\n", strerror (status)); + fprintf (stderr, "could not open mbox: %s\n", mu_errstring (status)); exit (1); } @@ -102,7 +103,7 @@ main (int argc, char **argv) if ((status = mailbox_get_message (mbox, i, &msg)) != 0 || (status = message_get_header (msg, &hdr)) != 0) { - printf ("%s, msg %d: %s\n", mboxname, i, strerror (status)); + printf ("%s, msg %d: %s\n", mboxname, i, mu_errstring (status)); continue; } if ((status = diff --git a/examples/mbox-explode.c b/examples/mbox-explode.c index d0a0656b3..ca00575e0 100644 --- a/examples/mbox-explode.c +++ b/examples/mbox-explode.c @@ -11,6 +11,7 @@ #include <time.h> #include <unistd.h> +#include <mailutils/errno.h> #include <mailutils/mailbox.h> #include <mailutils/registrar.h> @@ -51,7 +52,7 @@ main (int argc, char **argv) if ((status = mailbox_create_default (&mbox, mbox_name)) != 0) { fprintf (stderr, "could not create <%s>: %s\n", - mbox_name, strerror (status)); + mbox_name, mu_errstring (status)); exit (1); } if(debug) @@ -64,7 +65,7 @@ main (int argc, char **argv) if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) { fprintf (stderr, "could not open <%s>: %s\n", - mbox_name, strerror (status)); + mbox_name, mu_errstring (status)); exit (1); } mailbox_messages_count (mbox, &count); @@ -85,14 +86,14 @@ main (int argc, char **argv) if ((status = mailbox_get_message (mbox, msgno, &msg)) != 0) { fprintf (stderr, "msg %d: get message failed: %s\n", - msgno, strerror (status)); + msgno, mu_errstring (status)); mailbox_close (mbox); exit (1); } if ((status = message_get_num_parts (msg, &nparts))) { fprintf (stderr, "msg %d: get num parts failed: %s\n", - msgno, strerror (status)); + msgno, mu_errstring (status)); mailbox_close (mbox); exit (1); } @@ -110,14 +111,14 @@ main (int argc, char **argv) if ((status = message_get_part (msg, partno, &part))) { fprintf (stderr, "msg %d: get part %d failed: %s\n", - msgno, partno, strerror (status)); + msgno, partno, mu_errstring (status)); mailbox_close (mbox); exit (1); } if ((status = message_save_attachment (part, path, 0))) { fprintf (stderr, "msg %d part %d: save failed: %s\n", - msgno, partno, strerror (status)); + msgno, partno, mu_errstring (status)); break; } } diff --git a/examples/mimetest.c b/examples/mimetest.c index 724f9aeac..ec37315bb 100644 --- a/examples/mimetest.c +++ b/examples/mimetest.c @@ -28,6 +28,7 @@ #include <sys/types.h> +#include <mailutils/errno.h> #include <mailutils/mailbox.h> #include <mailutils/header.h> #include <mailutils/filter.h> @@ -67,7 +68,7 @@ main (int argc, char **argv) if ((ret = mailbox_create_default (&mbox, mailbox_name)) != 0) { - fprintf (stderr, "could not create - %s\n", strerror (ret)); + fprintf (stderr, "could not create - %s\n", mu_errstring (ret)); exit (2); } @@ -82,7 +83,7 @@ main (int argc, char **argv) /* Open the mailbox for reading only. */ if ((ret = mailbox_open (mbox, MU_STREAM_RDWR)) != 0) { - fprintf (stderr, "mailbox open - %s\n", strerror (ret)); + fprintf (stderr, "mailbox open - %s\n", mu_errstring (ret)); exit (2); } @@ -98,17 +99,17 @@ main (int argc, char **argv) if ((ret = mailbox_get_message (mbox, i, &msg)) != 0) { - fprintf (stderr, "mailbox_get_message - %s\n", strerror (ret)); + fprintf (stderr, "mailbox_get_message - %s\n", mu_errstring (ret)); exit (2); } if ((ret = message_size (msg, &msize)) != 0) { - fprintf (stderr, "message_size - %s\n", strerror (ret)); + fprintf (stderr, "message_size - %s\n", mu_errstring (ret)); exit (2); } if ((ret = message_get_header (msg, &hdr)) != 0) { - fprintf (stderr, "message_get_header - %s\n", strerror (ret)); + fprintf (stderr, "message_get_header - %s\n", mu_errstring (ret)); exit (2); } header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL); @@ -120,7 +121,7 @@ main (int argc, char **argv) if ((ret = message_get_num_parts (msg, &nparts)) != 0) { - fprintf (stderr, "message_get_num_parts - %s\n", strerror (ret)); + fprintf (stderr, "message_get_num_parts - %s\n", mu_errstring (ret)); exit (2); } printf ("-- Number of parts in message - %d\n", nparts); @@ -151,7 +152,7 @@ message_display_parts (message_t msg, const char *indent) /* How many parts does the message has? */ if ((ret = message_get_num_parts (msg, &nparts)) != 0) { - fprintf (stderr, "message_get_num_parts - %s\n", strerror (ret)); + fprintf (stderr, "message_get_num_parts - %s\n", mu_errstring (ret)); exit (2); } @@ -162,17 +163,17 @@ message_display_parts (message_t msg, const char *indent) { if ((ret = message_get_part (msg, j, &part)) != 0) { - fprintf (stderr, "mime_get_part - %s\n", strerror (ret)); + fprintf (stderr, "mime_get_part - %s\n", mu_errstring (ret)); exit (2); } if ((ret = message_size (part, &msize)) != 0) { - fprintf (stderr, "message_size - %s\n", strerror (ret)); + fprintf (stderr, "message_size - %s\n", mu_errstring (ret)); exit (2); } if ((ret = message_get_header (part, &hdr)) != 0) { - fprintf (stderr, "message_get_header - %s\n", strerror (ret)); + fprintf (stderr, "message_get_header - %s\n", mu_errstring (ret)); exit (2); } header_get_value (hdr, MU_HEADER_CONTENT_TYPE, type, sizeof (type), @@ -194,12 +195,12 @@ message_display_parts (message_t msg, const char *indent) ret = message_unencapsulate (part, &part, NULL); if (ret != 0) fprintf (stderr, "message_unencapsulate - %s\n", - strerror (ret)); + mu_errstring (ret)); break; } if ((ret = message_get_header (part, &hdr)) != 0) { - fprintf (stderr, "message_get_header - %s\n", strerror (ret)); + fprintf (stderr, "message_get_header - %s\n", mu_errstring (ret)); exit (2); } header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL); @@ -211,7 +212,7 @@ message_display_parts (message_t msg, const char *indent) indent); if ((ret = message_get_num_parts (part, &nsubparts)) != 0) { - fprintf (stderr, "mime_get_num_parts - %s\n", strerror (ret)); + fprintf (stderr, "mime_get_num_parts - %s\n", mu_errstring (ret)); exit (2); } strcpy (tmp, indent); diff --git a/examples/msg-send.c b/examples/msg-send.c index 692bfb201..1c85e6db3 100644 --- a/examples/msg-send.c +++ b/examples/msg-send.c @@ -8,13 +8,14 @@ #include <unistd.h> #include <mailutils/address.h> +#include <mailutils/errno.h> #include <mailutils/mailer.h> #include <mailutils/message.h> #include <mailutils/registrar.h> #include <mailutils/stream.h> #define C(X) {int e; if((e = X) != 0) { \ - fprintf(stderr, "%s failed: %s\n", #X, strerror(e)); \ + fprintf(stderr, "%s failed: %s\n", #X, mu_errstring(e)); \ exit(1); } } const char USAGE[] = diff --git a/examples/url-parse.c b/examples/url-parse.c index 7b912ba29..b4cf01ba9 100644 --- a/examples/url-parse.c +++ b/examples/url-parse.c @@ -1,3 +1,4 @@ +#include <mailutils/errno.h> #include <mailutils/url.h> #include <stdio.h> #include <string.h> @@ -21,13 +22,13 @@ main () if ((rc = url_create(&u, str)) != 0) { fprintf(stderr, "url_create %s ERROR: [%d] %s", - str, rc, strerror(rc)); + str, rc, mu_errstring(rc)); exit (1); } if ((rc = url_parse (u)) != 0) { printf ("%s --> FAILED: [%d] %s\n", - str, rc, strerror(rc)); + str, rc, mu_errstring(rc)); continue; } printf ("%s --> SUCCESS\n", str); diff --git a/from/from.c b/from/from.c index 60e2ac3c5..3b53e2188 100644 --- a/from/from.c +++ b/from/from.c @@ -33,8 +33,9 @@ #include <string.h> #include <unistd.h> -#include <mailutils/mailbox.h> #include <mailutils/address.h> +#include <mailutils/errno.h> +#include <mailutils/mailbox.h> #include <mailutils/registrar.h> int @@ -66,7 +67,7 @@ main(int argc, char **argv) if ((status = mailbox_create_default (&mbox, mailbox_name)) != 0) { - fprintf (stderr, "could not create/open: %s\n", strerror (status)); + fprintf (stderr, "could not create/open: %s\n", mu_errstring (status)); exit (1); } @@ -79,7 +80,7 @@ main(int argc, char **argv) if ((status = mailbox_open (mbox, MU_STREAM_READ)) != 0) { - fprintf (stderr, "could not create/open: %s\n", strerror (status)); + fprintf (stderr, "could not create/open: %s\n", mu_errstring (status)); exit (1); } @@ -92,7 +93,7 @@ main(int argc, char **argv) if ((status = mailbox_get_message (mbox, i, &msg)) != 0 || (status = message_get_header (msg, &hdr)) != 0) { - fprintf (stderr, "msg %d : %s\n", i, strerror(status)); + fprintf (stderr, "msg %d : %s\n", i, mu_errstring(status)); exit(2); } diff --git a/guimb/collect.c b/guimb/collect.c index 4d948f053..0988d15b0 100644 --- a/guimb/collect.c +++ b/guimb/collect.c @@ -39,7 +39,7 @@ collect_open_default () || mailbox_open (mbox, MU_STREAM_RDWR) != 0) { util_error ("can't open default mailbox %s: %s", - default_mailbox, strerror (errno)); + default_mailbox, mu_errstring (errno)); exit (1); } diff --git a/guimb/guimb.h b/guimb/guimb.h index fbed2955a..1840fa26c 100644 --- a/guimb/guimb.h +++ b/guimb/guimb.h @@ -26,6 +26,7 @@ #include <errno.h> #include <string.h> /* strerror(3), strdup(3) */ +#include <mailutils/errno.h> #include <mailutils/mailbox.h> #include <mailutils/message.h> #include <mailutils/header.h> diff --git a/imap4d/imap4d.h b/imap4d/imap4d.h index d6128e519..ae0782c04 100644 --- a/imap4d/imap4d.h +++ b/imap4d/imap4d.h @@ -71,6 +71,7 @@ #include <mailutils/address.h> #include <mailutils/body.h> +#include <mailutils/errno.h> #include <mailutils/error.h> #include <mailutils/filter.h> #include <mailutils/folder.h> diff --git a/mail/mail.c b/mail/mail.c index ea982689a..0b812e21d 100644 --- a/mail/mail.c +++ b/mail/mail.c @@ -341,17 +341,17 @@ main (int argc, char **argv) /* open the mailbox */ if (args.file == NULL) { - if (mailbox_create_default (&mbox, args.user) != 0) + if ((rc = mailbox_create_default (&mbox, args.user)) != 0) { util_error ("Can not create mailbox for %s: %s", args.user, - strerror (errno)); + mu_errstring (rc)); exit (EXIT_FAILURE); } } - else if (mailbox_create_default (&mbox, args.file) != 0) + else if ((rc = mailbox_create_default (&mbox, args.file)) != 0) { util_error ("Can not create mailbox %s: %s", args.file, - strerror (errno)); + mu_errstring (errno)); exit (EXIT_FAILURE); } @@ -368,7 +368,7 @@ main (int argc, char **argv) url_t url = NULL; mailbox_get_url (mbox, &url); util_error ("Can not open mailbox %s: %s", - url_to_string (url), strerror (rc)); + url_to_string (url), mu_errstring (rc)); exit (EXIT_FAILURE); } diff --git a/mail/mail.h b/mail/mail.h index fcd0b204e..d8e83992d 100644 --- a/mail/mail.h +++ b/mail/mail.h @@ -52,6 +52,7 @@ #include <readline/history.h> #endif +#include <mailutils/errno.h> #include <mailutils/mailbox.h> #include <mailutils/message.h> #include <mailutils/header.h> diff --git a/mailbox/message.c b/mailbox/message.c index df7e19db6..9797b788c 100644 --- a/mailbox/message.c +++ b/mailbox/message.c @@ -33,7 +33,9 @@ #include "md5-rsa.h" #include <message0.h> + #include <mailutils/address.h> +#include <mailutils/errno.h> #include <mailutils/mutil.h> #define MESSAGE_MODIFIED 0x10000; @@ -1017,7 +1019,7 @@ message_save_to_mailbox (message_t msg, ticket_t ticket, mu_debug_t debug, { mu_debug_print (debug, MU_DEBUG_TRACE, "mailbox_create_default (%s) failed: %s\n", toname, - strerror (rc)); + mu_errstring (rc)); goto end; } @@ -1048,7 +1050,7 @@ message_save_to_mailbox (message_t msg, ticket_t ticket, mu_debug_t debug, { mu_debug_print (debug, MU_DEBUG_TRACE, "mailbox_open (%s) failed: %s\n", toname, - strerror (rc)); + mu_errstring (rc)); goto end; } @@ -1056,7 +1058,7 @@ message_save_to_mailbox (message_t msg, ticket_t ticket, mu_debug_t debug, { mu_debug_print (debug, MU_DEBUG_TRACE, "mailbox_append_message (%s) failed: %s\n", toname, - strerror (rc)); + mu_errstring (rc)); goto end; } @@ -1068,7 +1070,7 @@ end: { mu_debug_print (debug, MU_DEBUG_TRACE, "mailbox_close (%s) failed: %s\n", toname, - strerror (rc)); + mu_errstring (rc)); } } else diff --git a/mailbox/wicket.c b/mailbox/wicket.c index defe82f97..2b0b32d6f 100644 --- a/mailbox/wicket.c +++ b/mailbox/wicket.c @@ -28,7 +28,9 @@ #include <unistd.h> #include <ctype.h> +#include <mailutils/errno.h> #include <mailutils/mutil.h> + #include <auth0.h> #include <url0.h> @@ -324,7 +326,7 @@ get_ticket (url_t url, const char *user, const char *filename, url_t * ticket) { /* TODO: send output to the debug stream */ /* - printf ("url_parse %s failed: [%d] %s\n", str, err, strerror (err)); + printf ("url_parse %s failed: [%d] %s\n", str, err, mu_errstring (err)); */ url_destroy (&u); continue; diff --git a/pop3d/apop.c b/pop3d/apop.c index a9f2253f9..1bf37b9e9 100644 --- a/pop3d/apop.c +++ b/pop3d/apop.c @@ -61,7 +61,7 @@ pop3d_apopuser (const char *user) syslog (LOG_INFO, "Bad permissions on APOP password db"); else syslog (LOG_ERR, "Unable to open APOP db: %s", - strerror (rc)); + mu_errstring (rc)); return NULL; } @@ -78,7 +78,7 @@ pop3d_apopuser (const char *user) mu_dbm_close (db); if (rc) { - syslog (LOG_ERR, "Can't fetch APOP data: %s", strerror (rc)); + syslog (LOG_ERR, "Can't fetch APOP data: %s", mu_errstring (rc)); return NULL; } password = calloc (MU_DATUM_SIZE(data) + 1, sizeof (*password)); diff --git a/pop3d/pop3d.h b/pop3d/pop3d.h index ab07b8ad6..cea4dcc1d 100644 --- a/pop3d/pop3d.h +++ b/pop3d/pop3d.h @@ -109,6 +109,7 @@ # include <strings.h> #endif +#include <mailutils/errno.h> #include <mailutils/mailbox.h> #include <mailutils/message.h> #include <mailutils/header.h> diff --git a/readmsg/readmsg.c b/readmsg/readmsg.c index 615f3f5de..cded0d3af 100644 --- a/readmsg/readmsg.c +++ b/readmsg/readmsg.c @@ -248,7 +248,7 @@ main (int argc, char **argv) status = mailbox_create_default (&mbox, mailbox_name); if (status != 0) { - fprintf (stderr, "could not create - %s\n", strerror(status)); + fprintf (stderr, "could not create - %s\n", mu_errstring(status)); exit (2); } @@ -263,7 +263,7 @@ main (int argc, char **argv) status = mailbox_open (mbox, MU_STREAM_READ); if (status != 0) { - fprintf (stderr, "mailbox open - %s\n", strerror(status)); + fprintf (stderr, "mailbox open - %s\n", mu_errstring(status)); exit (2); } @@ -282,7 +282,7 @@ main (int argc, char **argv) status = mailbox_get_message (mbox, set[i], &msg); if (status != 0) { - fprintf (stderr, "mailbox_get_message - %s\n", strerror (status)); + fprintf (stderr, "mailbox_get_message - %s\n", mu_errstring (status)); exit (2); } diff --git a/readmsg/readmsg.h b/readmsg/readmsg.h index 7a2929fbe..27c10636e 100644 --- a/readmsg/readmsg.h +++ b/readmsg/readmsg.h @@ -28,6 +28,7 @@ #include <errno.h> #include <getopt.h> +#include <mailutils/errno.h> #include <mailutils/mailbox.h> #include <mailutils/header.h> #include <mailutils/mime.h> diff --git a/sieve/sieve.c b/sieve/sieve.c index 92b53fd88..a47ddf80a 100644 --- a/sieve/sieve.c +++ b/sieve/sieve.c @@ -24,6 +24,7 @@ sieve script interpreter. #include "sieve.h" +#include <mailutils/errno.h> #include <mailutils/mailbox.h> #include <mailutils/mutil.h> #include <mailutils/registrar.h> @@ -188,10 +189,10 @@ execute_error (const char *script, message_t msg, int rc, const char *errmsg) message_get_uid (msg, &uid); if (rc) - fprintf (stderr, "%s on msg uid %d failed: %s\n", script, uid, errmsg); - else fprintf (stderr, "%s on msg uid %d failed: %s (%s)\n", script, uid, - errmsg, strerror (rc)); + errmsg, mu_errstring (rc)); + else + fprintf (stderr, "%s on msg uid %d failed: %s\n", script, uid, errmsg); } static void @@ -343,12 +344,12 @@ main (int argc, char *argv[]) if ((rc = wicket_create (&wicket, opts.tickets)) != 0) { fprintf (stderr, "wicket create <%s> failed: %s\n", - opts.tickets, strerror (rc)); + opts.tickets, mu_errstring (rc)); goto cleanup; } if ((rc = wicket_get_ticket (wicket, &ticket, 0, 0)) != 0) { - fprintf (stderr, "ticket get failed: %s\n", strerror (rc)); + fprintf (stderr, "ticket get failed: %s\n", mu_errstring (rc)); goto cleanup; } } @@ -358,17 +359,17 @@ main (int argc, char *argv[]) { if ((rc = mu_debug_create (&debug, interp))) { - fprintf (stderr, "mu_debug_create failed: %s\n", strerror (rc)); + fprintf (stderr, "mu_debug_create failed: %s\n", mu_errstring (rc)); goto cleanup; } if ((rc = mu_debug_set_level (debug, opts.debug_level))) { - fprintf (stderr, "mu_debug_set_level failed: %s\n", strerror (rc)); + fprintf (stderr, "mu_debug_set_level failed: %s\n", mu_errstring (rc)); goto cleanup; } if ((rc = mu_debug_set_print (debug, debug_print, interp))) { - fprintf (stderr, "mu_debug_set_print failed: %s\n", strerror (rc)); + fprintf (stderr, "mu_debug_set_print failed: %s\n", mu_errstring (rc)); goto cleanup; } } @@ -377,12 +378,12 @@ main (int argc, char *argv[]) if ((rc = mailer_create(&mailer, opts.mailer))) { fprintf (stderr, "mailer create <%s> failed: %s\n", - opts.mailer, strerror (rc)); + opts.mailer, mu_errstring (rc)); goto cleanup; } if (debug && (rc = mailer_set_debug (mailer, debug))) { - fprintf (stderr, "mailer_set_debug failed: %s\n", strerror (rc)); + fprintf (stderr, "mailer_set_debug failed: %s\n", mu_errstring (rc)); goto cleanup; } @@ -390,13 +391,13 @@ main (int argc, char *argv[]) if ((rc = mailbox_create_default (&mbox, opts.mbox)) != 0) { fprintf (stderr, "mailbox create <%s> failed: %s\n", - opts.mbox ? opts.mbox : "default", strerror (rc)); + opts.mbox ? opts.mbox : "default", mu_errstring (rc)); goto cleanup; } if (debug && (rc = mailbox_set_debug (mbox, debug))) { - fprintf (stderr, "mailbox_set_debug failed: %s\n", strerror (rc)); + fprintf (stderr, "mailbox_set_debug failed: %s\n", mu_errstring (rc)); goto cleanup; } @@ -407,20 +408,20 @@ main (int argc, char *argv[]) if ((rc = mailbox_get_folder (mbox, &folder))) { - fprintf (stderr, "mailbox_get_folder failed: %s", strerror (rc)); + fprintf (stderr, "mailbox_get_folder failed: %s", mu_errstring (rc)); goto cleanup; } if ((rc = folder_get_authority (folder, &auth))) { - fprintf (stderr, "folder_get_authority failed: %s", strerror (rc)); + fprintf (stderr, "folder_get_authority failed: %s", mu_errstring (rc)); goto cleanup; } /* Authentication-less folders don't have authorities. */ if (auth && (rc = authority_set_ticket (auth, ticket))) { - fprintf (stderr, "authority_set_ticket failed: %s", strerror (rc)); + fprintf (stderr, "authority_set_ticket failed: %s", mu_errstring (rc)); goto cleanup; } } @@ -434,7 +435,7 @@ main (int argc, char *argv[]) if (rc != 0) { fprintf (stderr, "open on %s failed: %s\n", - opts.mbox ? opts.mbox : "default", strerror (rc)); + opts.mbox ? opts.mbox : "default", mu_errstring (rc)); goto cleanup; } @@ -444,7 +445,7 @@ main (int argc, char *argv[]) if (rc != 0) { fprintf (stderr, "message count on %s failed: %s\n", - opts.mbox ? opts.mbox : "default", strerror (rc)); + opts.mbox ? opts.mbox : "default", mu_errstring (rc)); goto cleanup; } @@ -455,7 +456,7 @@ main (int argc, char *argv[]) if ((rc = mailbox_get_message (mbox, msgno, &msg)) != 0) { fprintf (stderr, "get message on %s (msg %d) failed: %s\n", - opts.mbox ? opts.mbox : "default", msgno, strerror (rc)); + opts.mbox ? opts.mbox : "default", msgno, mu_errstring (rc)); goto cleanup; } @@ -484,7 +485,7 @@ cleanup: on a later message. */ if ((e = mailbox_expunge (mbox)) != 0) fprintf (stderr, "expunge on %s failed: %s\n", - opts.mbox ? opts.mbox : "default", strerror (e)); + opts.mbox ? opts.mbox : "default", mu_errstring (e)); if(e && !rc) rc = e; diff --git a/sieve/sv.h b/sieve/sv.h index 892a09c2f..502f8862f 100644 --- a/sieve/sv.h +++ b/sieve/sv.h @@ -1,6 +1,7 @@ #ifndef SV_H #define SV_H +#include <mailutils/errno.h> #include <mailutils/mailbox.h> #include <mailutils/address.h> #include <mailutils/registrar.h> diff --git a/sieve/svcb.c b/sieve/svcb.c index |