bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-mailutils] Compiling mailutils 2.0 on solaris


From: Sergey Poznyakoff
Subject: Re: [bug-mailutils] Compiling mailutils 2.0 on solaris
Date: Wed, 01 Jul 2009 11:40:43 +0300

Hi Maarten,

>    Hi Sergey,
> 
> Actually, _PATH_SENDMAIL should have been defined in /usr/include/paths.h.
> Do you have this header?
>    I just checked, no include file in /usr/include has that string.

OK, I'll need to provide a substitute, then.

>    Upgrading guile fixed this.

OK, so what version of Guile you have now?

>    The strcasestr function isn't there on solaris. 

Ouch! That's unfortunate.

> Perhaps you can add your own implementation as with asprintf?

Sure. Please, try the attached patch.

Regards,
Sergey

diff --git a/config/mailutils-config.c b/config/mailutils-config.c
index 11335f1..99689b9 100644
--- a/config/mailutils-config.c
+++ b/config/mailutils-config.c
@@ -242,7 +242,7 @@ main (int argc, char **argv)
                  struct lib_descr *p;
                  
                  for (p = lib_descr; p->name; p++)
-                   if (strcasecmp (p->name, argv[0]) == 0)
+                   if (mu_c_strcasecmp (p->name, argv[0]) == 0)
                      break;
 
                  if (p->name)
diff --git a/examples/mimetest.c b/examples/mimetest.c
index ef12a40..868c7b3 100644
--- a/examples/mimetest.c
+++ b/examples/mimetest.c
@@ -199,7 +199,7 @@ message_display_parts (mu_message_t msg, int indent)
        encoding = "";
       ismulti = 0;
       if ((type[0]
-           && strncasecmp (type, "message/rfc822", strlen (type)) == 0)
+           && mu_c_strncasecmp (type, "message/rfc822", strlen (type)) == 0)
           || (mu_message_is_multipart (part, &ismulti) == 0 && ismulti))
         {
           if (!ismulti)
@@ -218,9 +218,9 @@ message_display_parts (mu_message_t msg, int indent)
           mu_message_destroy (&part, NULL);
         }
       else if (type[0] == '\0'
-               || (strncasecmp (type, "text/plain", strlen ("text/plain")) ==
+               || (mu_c_strncasecmp (type, "text/plain", strlen 
("text/plain")) ==
                    0)
-               || (strncasecmp (type, "text/html", strlen ("text/html")) ==
+               || (mu_c_strncasecmp (type, "text/html", strlen ("text/html")) 
==
                    0))
         {
           printf ("%*.*sText Message\n", indent, indent, "");
diff --git a/examples/mta.c b/examples/mta.c
index 424e92e..d43dfab 100644
--- a/examples/mta.c
+++ b/examples/mta.c
@@ -538,7 +538,7 @@ smtp_kw (const char *name)
   int i;
 
   for (i = 0; kw[i].name != NULL; i++)
-    if (strcasecmp (name, kw[i].name) == 0)
+    if (mu_c_strcasecmp (name, kw[i].name) == 0)
       return kw[i].code;
   return -1;
 }
@@ -547,7 +547,7 @@ static char *
 check_prefix (char *str, const char *prefix)
 {
   int pflen = strlen (prefix);
-  if (strlen (str) > pflen && strncasecmp (str, prefix, pflen) == 0)
+  if (strlen (str) > pflen && mu_c_strncasecmp (str, prefix, pflen) == 0)
     return str + pflen;
   else
     return NULL;
@@ -623,7 +623,7 @@ smtp (int fd)
            case KW_MAIL:
              if (argc == 2)
                from_person = check_prefix (argv[1], "from:");
-             else if (argc == 3 && strcasecmp (argv[1], "from:") == 0)
+             else if (argc == 3 && mu_c_strcasecmp (argv[1], "from:") == 0)
                from_person = argv[2];
              else
                from_person = NULL;
@@ -649,7 +649,7 @@ smtp (int fd)
            case KW_RCPT:
              if (argc == 2)
                rcpt_addr = check_prefix (argv[1], "to:");
-             else if (argc == 3 && strcasecmp (argv[1], "to:") == 0)
+             else if (argc == 3 && mu_c_strcasecmp (argv[1], "to:") == 0)
                rcpt_addr = argv[2];
              else
                rcpt_addr = NULL;
@@ -679,7 +679,7 @@ smtp (int fd)
            case KW_RCPT:
              if (argc == 2)
                rcpt_addr = check_prefix (argv[1], "to:");
-             else if (argc == 3 && strcasecmp (argv[1], "to:") == 0)
+             else if (argc == 3 && mu_c_strcasecmp (argv[1], "to:") == 0)
                rcpt_addr = argv[2];
              else
                rcpt_addr = NULL;
diff --git a/examples/nntpclient.c b/examples/nntpclient.c
index 61d4b65..c7131a2 100644
--- a/examples/nntpclient.c
+++ b/examples/nntpclient.c
@@ -43,6 +43,7 @@
 #include <mailutils/iterator.h>
 #include <mailutils/error.h>
 #include <mailutils/errno.h>
+#include <mailutils/mutil.h>
 
 /* A structure which contains information on the commands this program
    can understand. */
@@ -392,7 +393,7 @@ int com_mode (char *arg)
 {
   if (!valid_argument("mode", arg))
     return EINVAL;
-  if (strncasecmp (arg, "READER", 6) == 0)
+  if (mu_c_strncasecmp (arg, "READER", 6) == 0)
     return com_mode_reader (arg);
   return EINVAL;
 }
@@ -533,27 +534,27 @@ int com_list (char *arg)
     {
       status = com_list_active (arg);
    }
-  else if (strncasecmp (keyword, "ACTIVE.TIMES", 12) == 0)
+  else if (mu_c_strncasecmp (keyword, "ACTIVE.TIMES", 12) == 0)
     {
       status = com_list_active_times (arg);
     }
-  else if (strncasecmp (keyword, "ACTIVE", 6) == 0)
+  else if (mu_c_strncasecmp (keyword, "ACTIVE", 6) == 0)
     {
       status = com_list_active (arg);
     }
-  else if (strncasecmp (keyword, "EXTENSIONS", 10) == 0)
+  else if (mu_c_strncasecmp (keyword, "EXTENSIONS", 10) == 0)
     {
       status = com_list_extensions (arg);
     }
-  else if (strncasecmp (keyword, "DISTRIBUTIONS", 13) == 0)
+  else if (mu_c_strncasecmp (keyword, "DISTRIBUTIONS", 13) == 0)
     {
       status = com_list_distributions (arg);
     }
-  else if (strncasecmp (keyword, "DISTRIB.PATS", 12) == 0)
+  else if (mu_c_strncasecmp (keyword, "DISTRIB.PATS", 12) == 0)
     {
       status = com_list_distrib_pats (arg);
     }
-  else if (strncasecmp (keyword, "NEWSGROUPS", 10) == 0)
+  else if (mu_c_strncasecmp (keyword, "NEWSGROUPS", 10) == 0)
     {
       status = com_list_newsgroups (arg);
     }
@@ -806,7 +807,7 @@ com_newgroups (char *arg)
       char gmt[4];
       memset (gmt, 0, 4);
       sscanf (arg, "%4d%2d%2d %2d%2d%2d %3s", &year, &month, &day, &hour, 
&min, &sec, gmt);
-      is_gmt = strncasecmp ("GMT", gmt, 3) == 0;
+      is_gmt = mu_c_strncasecmp ("GMT", gmt, 3) == 0;
     }
 
   /* If nothing defined take the current time.  */
@@ -865,7 +866,7 @@ com_newnews (char *arg)
 
   wildmat = calloc (1, 512);
   sscanf (arg, "%511s %4d%2d%2d %2d%2d%2d %3s", wildmat, &year, &month, &day, 
&hour, &min, &sec, gmt);
-  is_gmt = strncasecmp ("GMT", gmt, 3) == 0;
+  is_gmt = mu_c_strncasecmp ("GMT", gmt, 3) == 0;
 
   if (year == 0)
     {
diff --git a/imap4d/create.c b/imap4d/create.c
index dd59ae2..61b29cc 100644
--- a/imap4d/create.c
+++ b/imap4d/create.c
@@ -98,7 +98,7 @@ imap4d_create (struct imap4d_command *command, 
imap4d_tokbuf_t tok)
     return util_finish (command, RESP_BAD, "Too few arguments");
 
   /* Creating, "Inbox" should always fail.  */
-  if (strcasecmp (name, "INBOX") == 0)
+  if (mu_c_strcasecmp (name, "INBOX") == 0)
     return util_finish (command, RESP_BAD, "Already exist");
 
   /* RFC 3501:
diff --git a/imap4d/delete.c b/imap4d/delete.c
index 514800b..fdac286 100644
--- a/imap4d/delete.c
+++ b/imap4d/delete.c
@@ -45,7 +45,7 @@ imap4d_delete (struct imap4d_command *command, 
imap4d_tokbuf_t tok)
 
   /* It is an error to attempt to delele "INBOX or a mailbox
      name that dos not exists.  */
-  if (strcasecmp (name, "INBOX") == 0)
+  if (mu_c_strcasecmp (name, "INBOX") == 0)
     return util_finish (command, RESP_NO, "Already exist");
 
  /* Allocates memory.  */
diff --git a/imap4d/fetch.c b/imap4d/fetch.c
index 092f740..8775718 100644
--- a/imap4d/fetch.c
+++ b/imap4d/fetch.c
@@ -359,9 +359,9 @@ bodystructure (mu_message_t msg, int extension)
          
       mu_argcv_get (buffer, " \t\r\n;=", NULL, &argc, &argv);
 
-      if (strcasecmp (argv[0], "MESSAGE/RFC822") == 0)
+      if (mu_c_strcasecmp (argv[0], "MESSAGE/RFC822") == 0)
         message_rfc822 = 1;
-      else if (strcasecmp (argv[0], "TEXT/PLAIN") == 0)
+      else if (mu_c_strcasecmp (argv[0], "TEXT/PLAIN") == 0)
         text_plain = 1;
 
       s = strchr (argv[0], '/');
@@ -410,7 +410,7 @@ bodystructure (mu_message_t msg, int extension)
                  
                default:
                  lvalue = argv[i];
-                 if (strcasecmp (lvalue, "charset") == 0)
+                 if (mu_c_strcasecmp (lvalue, "charset") == 0)
                    have_charset = 1;
 
                }
@@ -1136,7 +1136,7 @@ find_macro (const char *name)
 {
   int i;
   for (i = 0; fetch_macro_tab[i].macro; i++)
-    if (strcasecmp (fetch_macro_tab[i].macro, name) == 0)
+    if (mu_c_strcasecmp (fetch_macro_tab[i].macro, name) == 0)
       return fetch_macro_tab[i].exp;
   return NULL;
 }
@@ -1161,7 +1161,7 @@ find_fetch_att_tab (char *name)
 {
   struct fetch_att_tab *p;
   for (p = fetch_att_tab; p->name; p++)
-    if (strcasecmp (p->name, name) == 0)
+    if (mu_c_strcasecmp (p->name, name) == 0)
       return p;
   return NULL;
 }
@@ -1191,7 +1191,7 @@ parse_fetch_rfc822 (imap4d_parsebuf_t p)
   else if (p->token[0] == '.')
     {
       imap4d_parsebuf_next (p, 1);
-      if (strcasecmp (p->token, "HEADER") == 0)
+      if (mu_c_strcasecmp (p->token, "HEADER") == 0)
        {
          /* RFC822.HEADER
             Equivalent to BODY[HEADER].  Note that this did not result in
@@ -1205,14 +1205,14 @@ parse_fetch_rfc822 (imap4d_parsebuf_t p)
          ffc.peek = 1;
          imap4d_parsebuf_next (p, 0);
        }
-      else if (strcasecmp (p->token, "SIZE") == 0)
+      else if (mu_c_strcasecmp (p->token, "SIZE") == 0)
        {
          /* A number expressing the [RFC-2822] size of the message. */
          ffc.name = "RFC822.SIZE";
          ffc.fun = _frt_size;
          imap4d_parsebuf_next (p, 0);
        }
-      else if (strcasecmp (p->token, "TEXT") == 0)
+      else if (mu_c_strcasecmp (p->token, "TEXT") == 0)
        {
          /* RFC822.TEXT
             Equivalent to BODY[TEXT]. */
@@ -1231,7 +1231,7 @@ parse_fetch_rfc822 (imap4d_parsebuf_t p)
 static int
 _header_cmp (const void *a, const void *b)
 {
-  return strcasecmp ((char*)a, (char*)b);
+  return mu_c_strcasecmp ((char*)a, (char*)b);
 }
 
 /*
@@ -1266,21 +1266,21 @@ static int
 parse_section_text (imap4d_parsebuf_t p, struct fetch_function_closure *ffc,
                    int allow_mime)
 {
-  if (strcasecmp (p->token, "HEADER") == 0)
+  if (mu_c_strcasecmp (p->token, "HEADER") == 0)
     {
       /* "HEADER" / "HEADER.FIELDS" [".NOT"] SP header-list  */
       imap4d_parsebuf_next (p, 1);
       if (p->token[0] == '.')
        {
          imap4d_parsebuf_next (p, 1);
-         if (strcasecmp (p->token, "FIELDS"))
+         if (mu_c_strcasecmp (p->token, "FIELDS"))
            imap4d_parsebuf_exit (p, "Expected FIELDS");
          ffc->fun = _frt_header_fields;
          imap4d_parsebuf_next (p, 1);
          if (p->token[0] == '.')
            {
              imap4d_parsebuf_next (p, 1);
-             if (strcasecmp (p->token, "NOT") == 0)
+             if (mu_c_strcasecmp (p->token, "NOT") == 0)
                {
                  ffc->not = 1;
                  imap4d_parsebuf_next (p, 1);
@@ -1293,12 +1293,12 @@ parse_section_text (imap4d_parsebuf_t p, struct 
fetch_function_closure *ffc,
       else
        ffc->fun = _frt_header;
     }
-  else if (strcasecmp (p->token, "TEXT") == 0)
+  else if (mu_c_strcasecmp (p->token, "TEXT") == 0)
     {
       imap4d_parsebuf_next (p, 1);
       ffc->fun = _frt_body_text;
     }
-  else if (allow_mime && strcasecmp (p->token, "MIME") == 0)
+  else if (allow_mime && mu_c_strcasecmp (p->token, "MIME") == 0)
     {
       imap4d_parsebuf_next (p, 1);
       ffc->fun = _frt_mime;
@@ -1437,7 +1437,7 @@ static void
 parse_body_peek (imap4d_parsebuf_t p)
 {
   imap4d_parsebuf_next (p, 1);
-  if (strcasecmp (p->token, "PEEK") == 0)
+  if (mu_c_strcasecmp (p->token, "PEEK") == 0)
     {
       imap4d_parsebuf_next (p, 1);
       if (parse_body_args (p, 1))
@@ -1458,7 +1458,7 @@ parse_fetch_body (imap4d_parsebuf_t p)
                            "BODY", _frt_bodystructure0);
   else if (p->token[0] == '.')
     parse_body_peek (p);
-  else if (strcasecmp (p->token, "STRUCTURE") == 0)
+  else if (mu_c_strcasecmp (p->token, "STRUCTURE") == 0)
     {
       /* For compatibility with previous versions */
       append_simple_function (imap4d_parsebuf_data (p),
@@ -1483,11 +1483,11 @@ parse_fetch_att (imap4d_parsebuf_t p)
        append_simple_function (pclos, ent->name, ent->fun);
       imap4d_parsebuf_next (p, 0);
     }
-  else if (strcasecmp (p->token, "RFC822") == 0)
+  else if (mu_c_strcasecmp (p->token, "RFC822") == 0)
     parse_fetch_rfc822 (p);
-  else if (strcasecmp (p->token, "BODY") == 0)
+  else if (mu_c_strcasecmp (p->token, "BODY") == 0)
     parse_fetch_body (p);
-  else if (strcasecmp (p->token, "BODYSTRUCTURE") == 0)
+  else if (mu_c_strcasecmp (p->token, "BODYSTRUCTURE") == 0)
     {
       append_simple_function (pclos, "BODYSTRUCTURE", _frt_bodystructure);
       imap4d_parsebuf_next (p, 0);
diff --git a/imap4d/id.c b/imap4d/id.c
index 8a14848..3d6645d 100644
--- a/imap4d/id.c
+++ b/imap4d/id.c
@@ -32,7 +32,7 @@ eat_args (imap4d_tokbuf_t tok)
   p = imap4d_tokbuf_getarg (tok, n++);
   if (!p)
     return RESP_BAD;
-  if (strcasecmp (p, "NIL") == 0)
+  if (mu_c_strcasecmp (p, "NIL") == 0)
     {
       if (imap4d_tokbuf_getarg (tok, n))
        return RESP_BAD;
diff --git a/imap4d/idle.c b/imap4d/idle.c
index 6a73a15..ffe6961 100644
--- a/imap4d/idle.c
+++ b/imap4d/idle.c
@@ -41,7 +41,7 @@ imap4d_idle (struct imap4d_command *command, imap4d_tokbuf_t 
tok)
        {
           imap4d_getline (&token_str, &token_size, &token_len);          
          token_len = util_trim_nl (token_str, token_len);
-         if (token_len == 4 && strcasecmp (token_str, "done") == 0)
+         if (token_len == 4 && mu_c_strcasecmp (token_str, "done") == 0)
            break;
        }
       else if (time (NULL) - start > idle_timeout)
diff --git a/imap4d/list.c b/imap4d/list.c
index e19091f..f7049b4 100644
--- a/imap4d/list.c
+++ b/imap4d/list.c
@@ -159,8 +159,8 @@ imap4d_list (struct imap4d_command *command, 
imap4d_tokbuf_t tok)
                (*ref) ? delim : "");
     }
   /* There is only one mailbox in the "INBOX" hierarchy ... INBOX.  */
-  else if (strcasecmp (ref, "INBOX") == 0
-          || (ref[0] == 0 && strcasecmp (wcard, "INBOX") == 0))
+  else if (mu_c_strcasecmp (ref, "INBOX") == 0
+          || (ref[0] == 0 && mu_c_strcasecmp (wcard, "INBOX") == 0))
     {
       util_out (RESP_NONE, "LIST (\\NoInferiors) NIL INBOX");
     }
diff --git a/imap4d/namespace.c b/imap4d/namespace.c
index c6d344d..f2abf66 100644
--- a/imap4d/namespace.c
+++ b/imap4d/namespace.c
@@ -231,7 +231,7 @@ char *
 namespace_getfullpath (const char *name, const char *delim, int *nspace)
 {
   char *ret;
-  if (strcasecmp (name, "INBOX") == 0 && auth_data->change_uid)
+  if (mu_c_strcasecmp (name, "INBOX") == 0 && auth_data->change_uid)
     {
       ret = strdup (auth_data->mailbox);
       if (nspace)
diff --git a/imap4d/rename.c b/imap4d/rename.c
index d6cc9d4..d9aaf0e 100644
--- a/imap4d/rename.c
+++ b/imap4d/rename.c
@@ -53,7 +53,7 @@ imap4d_rename (struct imap4d_command *command, 
imap4d_tokbuf_t tok)
   oldname = imap4d_tokbuf_getarg (tok, IMAP4_ARG_1);
   newname = imap4d_tokbuf_getarg (tok, IMAP4_ARG_2);
 
-  if (strcasecmp (newname, "INBOX") == 0)
+  if (mu_c_strcasecmp (newname, "INBOX") == 0)
     return util_finish (command, RESP_NO, "Name Inbox is reservered");
 
   /* Allocates memory.  */
@@ -75,7 +75,7 @@ imap4d_rename (struct imap4d_command *command, 
imap4d_tokbuf_t tok)
   /* Renaming INBOX is permitted, and has special behavior.  It moves
      all messages in INBOX to a new mailbox with the given name,
      leaving INBOX empty.  */
-  if (strcasecmp (oldname, "INBOX") == 0)
+  if (mu_c_strcasecmp (oldname, "INBOX") == 0)
     {
       mu_mailbox_t newmbox = NULL;
       mu_mailbox_t inbox = NULL;
diff --git a/imap4d/search.c b/imap4d/search.c
index 4c8ce35..9943c7f 100644
--- a/imap4d/search.c
+++ b/imap4d/search.c
@@ -290,7 +290,7 @@ imap4d_search0 (imap4d_tokbuf_t tok, int isuid, char 
**err_text)
       return RESP_BAD;
     }
   
-  if (strcasecmp (parsebuf.token, "CHARSET") == 0)
+  if (mu_c_strcasecmp (parsebuf.token, "CHARSET") == 0)
     {
       if (!parse_gettoken (&parsebuf, 0))
        {
@@ -299,7 +299,7 @@ imap4d_search0 (imap4d_tokbuf_t tok, int isuid, char 
**err_text)
        }
 
       /* Currently only ASCII is supported */
-      if (strcasecmp (parsebuf.token, "US-ASCII"))
+      if (mu_c_strcasecmp (parsebuf.token, "US-ASCII"))
        {
          *err_text = "Charset not supported";
          return RESP_NO;
@@ -493,7 +493,7 @@ parse_search_key (struct parsebuf *pb)
       parse_gettoken (pb, 0);
       return node;
     }
-  else if (strcasecmp (pb->token, "ALL") == 0)
+  else if (mu_c_strcasecmp (pb->token, "ALL") == 0)
     {
       node = parse_alloc (pb, sizeof *node);
       node->type = node_value;
@@ -503,7 +503,7 @@ parse_search_key (struct parsebuf *pb)
       parse_gettoken (pb, 0);
       return node;
     }
-  else if (strcasecmp (pb->token, "NOT") == 0)
+  else if (mu_c_strcasecmp (pb->token, "NOT") == 0)
     {
       struct search_node *np;
       
@@ -520,7 +520,7 @@ parse_search_key (struct parsebuf *pb)
       
       return node;
     }
-  else if (strcasecmp (pb->token, "OR") == 0)
+  else if (mu_c_strcasecmp (pb->token, "OR") == 0)
     {
       struct search_node *leftarg, *rightarg;
       
@@ -550,7 +550,7 @@ parse_equiv_key (struct parsebuf *pb)
   int save_arg;
   imap4d_tokbuf_t save_tok;
   
-  for (condp = equiv_list; condp->name && strcasecmp (condp->name, pb->token);
+  for (condp = equiv_list; condp->name && mu_c_strcasecmp (condp->name, 
pb->token);
        condp++)
     ;
 
@@ -589,7 +589,7 @@ parse_simple_key (struct parsebuf *pb)
   size_t *set = NULL;
   int n = 0;
   
-  for (condp = condlist; condp->name && strcasecmp (condp->name, pb->token);
+  for (condp = condlist; condp->name && mu_c_strcasecmp (condp->name, 
pb->token);
        condp++)
     ;
 
diff --git a/imap4d/status.c b/imap4d/status.c
index 7546e5d..25da36c 100644
--- a/imap4d/status.c
+++ b/imap4d/status.c
@@ -48,7 +48,7 @@ status_get_handler (const char *name)
   struct status_table *p;
 
   for (p = status_table; p->name; p++)
-    if (strcasecmp (p->name, name) == 0)
+    if (mu_c_strcasecmp (p->name, name) == 0)
       return p->fun;
   return NULL;
 }
diff --git a/imap4d/store.c b/imap4d/store.c
index c47c482..c4839a3 100644
--- a/imap4d/store.c
+++ b/imap4d/store.c
@@ -55,14 +55,14 @@ store_thunk (imap4d_parsebuf_t p)
   else
     pclos->how = STORE_SET;
   
-  if (strcasecmp (data, "FLAGS"))
+  if (mu_c_strcasecmp (data, "FLAGS"))
     imap4d_parsebuf_exit (p, "Bogus data item");
   data = imap4d_parsebuf_next (p, 1);
 
   if (*data == '.')
     {
       data = imap4d_parsebuf_next (p, 1);
-      if (strcasecmp (data, "SILENT") == 0)
+      if (mu_c_strcasecmp (data, "SILENT") == 0)
        {
          pclos->ack = 0;
          imap4d_parsebuf_next (p, 1);
diff --git a/imap4d/uid.c b/imap4d/uid.c
index d0afe26..624a36c 100644
--- a/imap4d/uid.c
+++ b/imap4d/uid.c
@@ -35,13 +35,13 @@ imap4d_uid (struct imap4d_command *command, imap4d_tokbuf_t 
tok)
 
   cmd = imap4d_tokbuf_getarg (tok, IMAP4_ARG_1);
   
-  if (strcasecmp (cmd, "FETCH") == 0)
+  if (mu_c_strcasecmp (cmd, "FETCH") == 0)
     rc = imap4d_fetch0 (tok, 1, &err_text);
-  else if (strcasecmp (cmd, "COPY") == 0)
+  else if (mu_c_strcasecmp (cmd, "COPY") == 0)
     rc = imap4d_copy0 (tok, 1, &err_text);
-  else if (strcasecmp (cmd, "STORE") == 0)
+  else if (mu_c_strcasecmp (cmd, "STORE") == 0)
     rc = imap4d_store0 (tok, 1, &err_text);
-  else if (strcasecmp (cmd, "SEARCH") == 0)
+  else if (mu_c_strcasecmp (cmd, "SEARCH") == 0)
     rc = imap4d_search0 (tok, 1, &err_text);
   else
     {
diff --git a/imap4d/util.c b/imap4d/util.c
index 618cab0..42360d8 100644
--- a/imap4d/util.c
+++ b/imap4d/util.c
@@ -470,7 +470,7 @@ util_getcommand (char *cmd, struct imap4d_command 
command_table[])
   for (i = 0; command_table[i].name != 0; i++)
     {
       if (strlen (command_table[i].name) == len &&
-         !strcasecmp (command_table[i].name, cmd))
+         !mu_c_strcasecmp (command_table[i].name, cmd))
        return &command_table[i];
     }
   return NULL;
@@ -598,7 +598,7 @@ util_attribute_to_type (const char *item, int *type)
 {
   int i;
   for (i = 0; i < _imap4d_nattr; i++)
-    if (strcasecmp (item, _imap4d_attrlist[i].name) == 0)
+    if (mu_c_strcasecmp (item, _imap4d_attrlist[i].name) == 0)
       {
        *type = _imap4d_attrlist[i].flag;
        return 0;
diff --git a/include/mailutils/mutil.h b/include/mailutils/mutil.h
index bcb6292..e5a94d2 100644
--- a/include/mailutils/mutil.h
+++ b/include/mailutils/mutil.h
@@ -128,7 +128,7 @@ extern int mu_string_unfold (char *text, size_t *plen);
 extern int mu_unre_set_regex (const char *str, int caseflag, char **errp);
 extern int mu_unre_subject  (const char *subject, const char **new_subject);
 
-extern char *mu_charset_lookup (char *lang, char *terr);
+extern const char *mu_charset_lookup (char *lang, char *terr);
 
 extern int mu_true_answer_p (const char *p);
 extern int mu_scheme_autodetect_p (mu_url_t);
@@ -160,6 +160,9 @@ extern int mu_stream_flags_to_mode (int flags, int isdir);
 extern int mu_parse_stream_perm_string (int *pmode, const char *str,
                                        const char **endp);
   
+
+extern int mu_c_strcasecmp (const char *a, const char *b);
+extern int mu_c_strncasecmp (const char *a, const char *b, size_t n);
   
 #ifdef __cplusplus
 }
diff --git a/include/mailutils/sys/pop3.h b/include/mailutils/sys/pop3.h
index c6dc142..b06e342 100644
--- a/include/mailutils/sys/pop3.h
+++ b/include/mailutils/sys/pop3.h
@@ -23,6 +23,7 @@
 #include <sys/types.h>
 #include <mailutils/pop3.h>
 #include <mailutils/errno.h>
+#include <mailutils/mutil.h>
 
 #ifdef DMALLOC
 # include <dmalloc.h>
@@ -138,7 +139,7 @@ while (0)
 #define MU_POP3_CHECK_OK(pop3) \
 do \
   { \
-     if (strncasecmp (pop3->ack.buf, "+OK", 3) != 0) \
+     if (mu_c_strncasecmp (pop3->ack.buf, "+OK", 3) != 0) \
        { \
           pop3->state = MU_POP3_NO_STATE; \
           return EACCES; \
diff --git a/lib/mailcap.c b/lib/mailcap.c
index 5a43329..2e945fa 100644
--- a/lib/mailcap.c
+++ b/lib/mailcap.c
@@ -182,7 +182,7 @@ mime_context_get_content_type_value (struct mime_context 
*ctx,
 
       mu_iterator_current (itr, (void**) &item);
       p = strchr (item, '=');
-      if (p - item == len && strncasecmp (item, name, len) == 0)
+      if (p - item == len && mu_c_strncasecmp (item, name, len) == 0)
        {
          rc = 0;
          *ptr = ++p;
diff --git a/libmu_auth/sql.c b/libmu_auth/sql.c
index 58b6609..c318a5a 100644
--- a/libmu_auth/sql.c
+++ b/libmu_auth/sql.c
@@ -250,7 +250,7 @@ decode_tuple_new (mu_sql_connection_t conn, int n,
   rc = get_field (conn, MU_AUTH_QUOTA, &squota, 0);
   if (rc == 0)
     {
-      if (strcasecmp (squota, "none") == 0)
+      if (mu_c_strcasecmp (squota, "none") == 0)
        quota = 0;
       else
        {
diff --git a/libmu_scm/mu_message.c b/libmu_scm/mu_message.c
index 5c73e42..ba227b1 100644
--- a/libmu_scm/mu_message.c
+++ b/libmu_scm/mu_message.c
@@ -425,7 +425,7 @@ string_sloppy_member (SCM lst, char *name)
     {
       SCM car = SCM_CAR (lst);
       if (scm_is_string (car)
-         && strcasecmp (scm_i_string_chars (car), name) == 0)
+         && mu_c_strcasecmp (scm_i_string_chars (car), name) == 0)
        return 1;
     }
   return 0;
diff --git a/libmu_sieve/actions.c b/libmu_sieve/actions.c
index 65585dc..f0ea582 100644
--- a/libmu_sieve/actions.c
+++ b/libmu_sieve/actions.c
@@ -382,7 +382,7 @@ check_redirect_loop (mu_message_t msg)
   for (i = 1; !loop && i <= num; i++)
     {
       mu_header_get_field_name (hdr, i, buf, sizeof buf, NULL);
-      if (strcasecmp (buf, "X-Loop-Prevention") == 0)
+      if (mu_c_strcasecmp (buf, "X-Loop-Prevention") == 0)
        {
          size_t j, cnt = 0;
          mu_address_t addr;
@@ -395,7 +395,7 @@ check_redirect_loop (mu_message_t msg)
          for (j = 1; !loop && j <= cnt; j++)
            {
              mu_address_get_email (addr, j, buf, sizeof buf, NULL);
-             if (strcasecmp (buf, email) == 0)
+             if (mu_c_strcasecmp (buf, email) == 0)
                loop = 1;
            }
          mu_address_destroy (&addr);
diff --git a/libmu_sieve/comparator.c b/libmu_sieve/comparator.c
index e9cf453..e38a730 100644
--- a/libmu_sieve/comparator.c
+++ b/libmu_sieve/comparator.c
@@ -417,7 +417,7 @@ i_octet_eq (const char *pattern, const char *text)
 static int
 i_ascii_casemap_is (const char *pattern, const char *text)
 {
-  return strcasecmp (pattern, text) == 0;
+  return mu_c_strcasecmp (pattern, text) == 0;
 }
 
 static int
@@ -450,7 +450,7 @@ i_ascii_casemap_regex (const char *pattern, const char 
*text)
 static int
 i_ascii_casemap_eq (const char *pattern, const char *text)
 {
-  return strcasecmp (text, pattern);
+  return mu_c_strcasecmp (text, pattern);
 }
 
 /* :comparator i;ascii-numeric */
diff --git a/libmu_sieve/extensions/list.c b/libmu_sieve/extensions/list.c
index 7eb896e..ffc1e18 100644
--- a/libmu_sieve/extensions/list.c
+++ b/libmu_sieve/extensions/list.c
@@ -56,7 +56,7 @@ retrieve_next_header (struct header_closure *hc, char *name, 
char **pval)
   while (!mu_header_get_field_name (hc->header, hc->index, buf, sizeof(buf), 
&n))
     {
       int i = hc->index++;
-      if (strcasecmp (buf, name) == 0)
+      if (mu_c_strcasecmp (buf, name) == 0)
        {
          if (mu_header_aget_field_value (hc->header, i, &hc->value))
            return 1;
diff --git a/libmu_sieve/extensions/spamd.c b/libmu_sieve/extensions/spamd.c
index c502684..f0fbe02 100644
--- a/libmu_sieve/extensions/spamd.c
+++ b/libmu_sieve/extensions/spamd.c
@@ -185,9 +185,9 @@ decode_float (long *vn, char *str, int digits)
 static int
 decode_boolean (char *str)
 {
-  if (strcasecmp (str, "true") == 0)
+  if (mu_c_strcasecmp (str, "true") == 0)
     return 1;
-  else if (strcasecmp (str, "false") == 0)
+  else if (mu_c_strcasecmp (str, "false") == 0)
     return 0;
   /*else?*/
   return 0;
diff --git a/libmu_sieve/extensions/vacation.c 
b/libmu_sieve/extensions/vacation.c
index 72715d2..e4a9cf1 100644
--- a/libmu_sieve/extensions/vacation.c
+++ b/libmu_sieve/extensions/vacation.c
@@ -252,8 +252,8 @@ bulk_precedence_p (mu_header_t hdr)
   char *str;
   if (mu_header_aget_value (hdr, MU_HEADER_PRECEDENCE, &str) == 0)
     {
-      rc = strcasecmp (str, "bulk") == 0
-          || strcasecmp (str, "junk") == 0;
+      rc = mu_c_strcasecmp (str, "bulk") == 0
+          || mu_c_strcasecmp (str, "junk") == 0;
       free (str);
     }
   return rc;
diff --git a/libmu_sieve/tests.c b/libmu_sieve/tests.c
index 9148a87..82752ea 100644
--- a/libmu_sieve/tests.c
+++ b/libmu_sieve/tests.c
@@ -166,7 +166,7 @@ retrieve_header (void *item, void *data, int idx, char 
**pval)
   while (!mu_header_get_field_name (hc->header, hc->index, buf, sizeof(buf), 
&n))
     {
       int i = hc->index++;
-      if (strcasecmp (buf, (char*)item) == 0)
+      if (mu_c_strcasecmp (buf, (char*)item) == 0)
        {
          if (mu_header_aget_field_value_unfold (hc->header, i, pval))
            return 1;
@@ -245,7 +245,7 @@ retrieve_envelope (void *item, void *data, int idx, char 
**pval)
     {
       const char *buf;
       
-      if (strcasecmp ((char*)item, "from") != 0)
+      if (mu_c_strcasecmp ((char*)item, "from") != 0)
        return 1;
 
       if (mu_envelope_sget_sender ((mu_envelope_t)ap->data, &buf))
diff --git a/libproto/imap/folder.c b/libproto/imap/folder.c
index e34e874..3890267 100644
--- a/libproto/imap/folder.c
+++ b/libproto/imap/folder.c
@@ -51,6 +51,7 @@
 #include <mailutils/tls.h>
 #include <mailutils/nls.h>
 #include <mailutils/secret.h>
+#include <mailutils/mutil.h>
 
 /* For dbg purposes set to one to see different level of traffic.  */
 /* Print to stderr the command sent to the IMAP server.  */
@@ -382,7 +383,7 @@ find_auth_method (const char *name)
   struct auth_tab *p;
 
   for (p = auth_tab; p->name; p++)
-    if (strcasecmp (p->name, name) == 0)
+    if (mu_c_strcasecmp (p->name, name) == 0)
       return p->method;
 
   return NULL;
@@ -484,7 +485,7 @@ folder_imap_get_authority (mu_folder_t folder, 
mu_authority_t *pauth)
        return EINVAL;
 
       if (folder->url->auth == NULL
-         || strcasecmp (folder->url->auth, "*") == 0)
+         || mu_c_strcasecmp (folder->url->auth, "*") == 0)
        {
          status = folder_set_auth_method (folder, authenticate_imap_select);
        }
@@ -552,7 +553,7 @@ check_capa (f_imap_t f_imap, char *capa)
 
   read_capa (f_imap, 0);
   for (i = 0; i < f_imap->capac; i++)
-    if (strcasecmp (f_imap->capav[i], capa) == 0)
+    if (mu_c_strcasecmp (f_imap->capav[i], capa) == 0)
       return 0;
   return 1;
 }
@@ -722,13 +723,13 @@ folder_imap_open (mu_folder_t folder, int flags)
        /* Are they open for business ?  The server send an untagged response
           for greeting. Tecnically it can be OK/PREAUTH/BYE.  The BYE is
           the one that we do not want, server being unfriendly.  */
-       if (strncasecmp (f_imap->buffer, "* PREAUTH", 9) == 0)
+       if (mu_c_strncasecmp (f_imap->buffer, "* PREAUTH", 9) == 0)
          {
            f_imap->state = IMAP_AUTH_DONE;
          }
        else
          {
-            if (strncasecmp (f_imap->buffer, "* OK", 4) != 0)
+            if (mu_c_strncasecmp (f_imap->buffer, "* OK", 4) != 0)
               CHECK_ERROR_CLOSE (folder, f_imap, EACCES);
             f_imap->state = IMAP_AUTH;
          }
@@ -1433,12 +1434,12 @@ imap_list (f_imap_t f_imap)
       char *p = tok;
       while ((tok = strtok_r (p, " ()", &s)) != NULL)
        {
-         if (strcasecmp (tok, "\\Noselect") == 0)
+         if (mu_c_strcasecmp (tok, "\\Noselect") == 0)
            lr->type |= MU_FOLDER_ATTRIBUTE_DIRECTORY;
-         else if (strcasecmp (tok, "\\Noinferiors") == 0)
+         else if (mu_c_strcasecmp (tok, "\\Noinferiors") == 0)
            lr->type |= MU_FOLDER_ATTRIBUTE_FILE;
-         else if (strcasecmp (tok, "\\Marked") == 0
-                  || strcasecmp (tok, "\\Unmarked") == 0)
+         else if (mu_c_strcasecmp (tok, "\\Marked") == 0
+                  || mu_c_strcasecmp (tok, "\\Unmarked") == 0)
            /* nothing */;
          else
            lr->type |= MU_FOLDER_ATTRIBUTE_DIRECTORY;
@@ -1453,7 +1454,7 @@ imap_list (f_imap_t f_imap)
       
       /* Hiearchy delimeter.  */
       tok = argv[0];
-      if (tok && tok[1] == 0 && strcasecmp (tok, "NIL"))
+      if (tok && tok[1] == 0 && mu_c_strcasecmp (tok, "NIL"))
        lr->separator = tok[0];
       /* The path.  */
       tok = argv[1];
@@ -1751,7 +1752,7 @@ imap_flags (char **ptr, int *pflags)
       while (**ptr && **ptr != ' ' && **ptr != ')')
         ++(*ptr);
 
-      /* Save the end for the strcasecmp.  */
+      /* Save the end for the mu_c_strcasecmp.  */
       end = *ptr;
 
       /* Bail out.  */
@@ -1763,27 +1764,27 @@ imap_flags (char **ptr, int *pflags)
        flags |= MU_ATTRIBUTE_SEEN;
       else
        {
-         if (strncasecmp (start, "\\Seen", end - start) == 0)
+         if (mu_c_strncasecmp (start, "\\Seen", end - start) == 0)
            {
              flags |= MU_ATTRIBUTE_READ;
            }
-         else if (strncasecmp (start, "\\Answered", end - start) == 0)
+         else if (mu_c_strncasecmp (start, "\\Answered", end - start) == 0)
            {
              flags |= MU_ATTRIBUTE_ANSWERED;
            }
-         else if (strncasecmp (start, "\\Flagged", end - start) == 0)
+         else if (mu_c_strncasecmp (start, "\\Flagged", end - start) == 0)
            {
              flags |= MU_ATTRIBUTE_FLAGGED;
            }
-         else if (strncasecmp (start, "\\Deleted", end - start) == 0)
+         else if (mu_c_strncasecmp (start, "\\Deleted", end - start) == 0)
            {
              flags |= MU_ATTRIBUTE_DELETED;
            }
-         else if (strncasecmp (start, "\\Draft", end - start) == 0)
+         else if (mu_c_strncasecmp (start, "\\Draft", end - start) == 0)
            {
              flags |= MU_ATTRIBUTE_DRAFT;
            }
-         else if (strncasecmp (start, "\\Recent", end - start))
+         else if (mu_c_strncasecmp (start, "\\Recent", end - start))
            flags |= MU_ATTRIBUTE_SEEN;
        }
     }
@@ -2007,14 +2008,14 @@ imap_fetch (f_imap_t f_imap)
        {
          status = imap_fetch_flags (f_imap, &sp);
        }
-      else if (strcasecmp (token, "BODY") == 0)
+      else if (mu_c_strcasecmp (token, "BODY") == 0)
        {
          if (*sp == '[')
            status = imap_body (f_imap, &sp);
          else
            status = imap_bodystructure (f_imap, &sp);
        }
-      else if (strcasecmp (token, "BODYSTRUCTURE") == 0)
+      else if (mu_c_strcasecmp (token, "BODYSTRUCTURE") == 0)
        {
          status = imap_bodystructure (f_imap, &sp);
        }
@@ -2028,15 +2029,15 @@ imap_fetch (f_imap_t f_imap)
            {
              sp++;
              imap_token (token, sizeof token, &sp);
-             if (strcasecmp (token, "SIZE") == 0)
+             if (mu_c_strcasecmp (token, "SIZE") == 0)
                {
                  status = imap_rfc822_size (f_imap, &sp);
                }
-             else if (strcasecmp (token, "TEXT") == 0)
+             else if (mu_c_strcasecmp (token, "TEXT") == 0)
                {
                  status = imap_rfc822_text (f_imap, &sp);
                }
-             else if (strcasecmp (token, "HEADER") == 0)
+             else if (mu_c_strcasecmp (token, "HEADER") == 0)
                {
                  status = imap_rfc822_header (f_imap, &sp);
                }
@@ -2117,13 +2118,13 @@ imap_token (char *buf, size_t len, char **ptr)
    name no matter what the case is).
    */
 static int
-imap_mailbox_name_match(const char* pattern, const char* mailbox)
+imap_mailbox_name_match (const char* pattern, const char* mailbox)
 {
-  if(strcasecmp(pattern, "inbox") == 0)
-  {
-    return strcasecmp(pattern, mailbox);
-  }
-  return fnmatch(pattern, mailbox, 0);
+  if (mu_c_strcasecmp (pattern, "inbox") == 0)
+    {
+      return mu_c_strcasecmp (pattern, mailbox);
+    }
+  return fnmatch (pattern, mailbox, 0);
 }
 
 /* C99 says that a conforming implementations of snprintf () should return the
@@ -2351,7 +2352,7 @@ imap_parse (f_imap_t f_imap)
          MU_DEBUG2 (folder->debug, MU_DEBUG_PROT, "* %s %s\n",
                     response, remainder);
          /* Is it a Status Response.  */
-         if (strcasecmp (response, "OK") == 0)
+         if (mu_c_strcasecmp (response, "OK") == 0)
            {
              /* Check for status response [code].  */
              if (*remainder == '[')
@@ -2364,14 +2365,14 @@ imap_parse (f_imap_t f_imap)
                  subtag = strtok_r (cruft, " ", &sp1);
                  if (!subtag) subtag = empty;
 
-                 if (strcasecmp (subtag, "ALERT") == 0)
+                 if (mu_c_strcasecmp (subtag, "ALERT") == 0)
                    {
                      /* The human-readable text contains a special alert that
                         MUST be presented to the user in a fashion that calls
                         the user's attention to the message.  */
                      mu_error (_("ALERT: %s"), (sp) ? sp : "");
                    }
-                 else if (strcasecmp (subtag, "BADCHARSET") == 0)
+                 else if (mu_c_strcasecmp (subtag, "BADCHARSET") == 0)
                    {
                      /* Optionally followed by a parenthesized list of
                         charsets.  A SEARCH failed because the given charset
@@ -2380,7 +2381,7 @@ imap_parse (f_imap_t f_imap)
                         charsets that are supported by this implementation. */
                      mu_error (_("BAD CHARSET: %s"), (sp) ? sp : "");
                    }
-                 else if (strcasecmp (subtag, "CAPABILITY") == 0)
+                 else if (mu_c_strcasecmp (subtag, "CAPABILITY") == 0)
                    {
                      /* Followed by a list of capabilities.  This can appear
                         in the initial OK or PREAUTH response to transmit an
@@ -2389,7 +2390,7 @@ imap_parse (f_imap_t f_imap)
                         it recognizes this response.  */
                      parse_capa (f_imap, cruft);
                    }
-                 else if (strcasecmp (subtag, "NEWNAME") == 0)
+                 else if (mu_c_strcasecmp (subtag, "NEWNAME") == 0)
                    {
                      /* Followed by a mailbox name and a new mailbox name.  A
                         SELECT or EXAMINE failed because the target mailbox
@@ -2399,14 +2400,14 @@ imap_parse (f_imap_t f_imap)
                         reissued with the new mailbox name. */
                      mu_error ("NEWNAME: %s", (sp) ? sp : "");
                    }
-                 else if (strcasecmp (subtag, "PARSE") == 0)
+                 else if (mu_c_strcasecmp (subtag, "PARSE") == 0)
                    {
                      /* The human-readable text represents an error in
                         parsing the [RFC-822] header or [MIME-IMB] headers
                         of a message in the mailbox.  */
                      mu_error ("PARSE: %s", (sp) ? sp : "");
                    }
-                 else if (strcasecmp (subtag, "PERMANENTFLAGS") == 0)
+                 else if (mu_c_strcasecmp (subtag, "PERMANENTFLAGS") == 0)
                    {
                      /* Followed by a parenthesized list of flags, indicates
                         which of the known flags that the client can change
@@ -2421,19 +2422,19 @@ imap_parse (f_imap_t f_imap)
                         that it is possible to create new keywords by
                         attempting to store those flags in the mailbox.  */
                    }
-                 else if (strcasecmp (subtag, "READ-ONLY") == 0)
+                 else if (mu_c_strcasecmp (subtag, "READ-ONLY") == 0)
                    {
                      /* The mailbox is selected read-only, or its access
                         while selected has changed from read-write to
                         read-only.  */
                    }
-                 else if (strcasecmp (subtag, "READ-WRITE") == 0)
+                 else if (mu_c_strcasecmp (subtag, "READ-WRITE") == 0)
                    {
                      /* The mailbox is selected read-write, or its access
                         while selected has changed from read-only to
                         read-write.  */
                    }
-                 else if (strcasecmp (subtag, "TRYCREATE") == 0)
+                 else if (mu_c_strcasecmp (subtag, "TRYCREATE") == 0)
                    {
                      /* An APPEND or COPY attempt is failing because the
                         target mailbox does not exist (as opposed to some
@@ -2442,7 +2443,7 @@ imap_parse (f_imap_t f_imap)
                         created by the CREATE command.  */
                      mu_error ("TRYCREATE: %s", (sp) ? sp : "");
                    }
-                 else if (strcasecmp (subtag, "UIDNEXT") == 0)
+                 else if (mu_c_strcasecmp (subtag, "UIDNEXT") == 0)
                    {
                      /* Followed by a decimal number, indicates the next
                         unique identifier value.  Refer to section 2.3.1.1
@@ -2451,7 +2452,7 @@ imap_parse (f_imap_t f_imap)
                      if (value)
                        f_imap->selected->uidnext = strtol (value, NULL, 10);
                    }
-                 else if (strcasecmp (subtag, "UIDVALIDITY") == 0)
+                 else if (mu_c_strcasecmp (subtag, "UIDVALIDITY") == 0)
                    {
                      /* Followed by a decimal number, indicates the unique
                         identifier validity value.  Refer to section 2.3.1.1
@@ -2461,7 +2462,7 @@ imap_parse (f_imap_t f_imap)
                        f_imap->selected->uidvalidity = strtol (value,
                                                                NULL, 10);
                    }
-                 else if (strcasecmp (subtag, "UNSEEN") == 0)
+                 else if (mu_c_strcasecmp (subtag, "UNSEEN") == 0)
                    {
                      /* Followed by a decimal number, indicates the number of
                         the first message without the \Seen flag set.  */
@@ -2485,21 +2486,21 @@ imap_parse (f_imap_t f_imap)
                  mu_error (_("Untagged OK: %s"), remainder);
                }
            }
-         else if (strcasecmp (response, "NO") == 0)
+         else if (mu_c_strcasecmp (response, "NO") == 0)
            {
              /* This does not mean failure but rather a strong warning.  */
              mu_error (_("Untagged NO: %s"), remainder);
            }
-         else if (strcasecmp (response, "BAD") == 0)
+         else if (mu_c_strcasecmp (response, "BAD") == 0)
            {
              /* We're dead, protocol/syntax error.  */
              mu_error (_("Untagged BAD: %s"), remainder);
            }
-         else if (strcasecmp (response, "PREAUTH") == 0)
+         else if (mu_c_strcasecmp (response, "PREAUTH") == 0)
            {
              /* Should we be dealing with this?  */
            }
-         else if (strcasecmp (response, "BYE") == 0)
+         else if (mu_c_strcasecmp (response, "BYE") == 0)
            {
              /* We should close the stream. This is not recoverable.  */
              done = 1;
@@ -2509,47 +2510,47 @@ imap_parse (f_imap_t f_imap)
              mu_monitor_unlock (f_imap->folder->monitor);
              mu_stream_close (f_imap->folder->stream);
            }
-         else if (strcasecmp (response, "CAPABILITY") == 0)
+         else if (mu_c_strcasecmp (response, "CAPABILITY") == 0)
            {
              parse_capa (f_imap, remainder);
            }
-         else if (strcasecmp (remainder, "EXISTS") == 0)
+         else if (mu_c_strcasecmp (remainder, "EXISTS") == 0)
            {
              f_imap->selected->messages_count = strtol (response, NULL, 10);
            }
-         else if (strcasecmp (remainder, "EXPUNGE") == 0)
+         else if (mu_c_strcasecmp (remainder, "EXPUNGE") == 0)
            {
              unsigned int msgno = strtol (response, NULL, 10);
              status = imap_expunge (f_imap, msgno);
            }
-         else if (strncasecmp (remainder, "FETCH", 5) == 0)
+         else if (mu_c_strncasecmp (remainder, "FETCH", 5) == 0)
            {
              status = imap_fetch (f_imap);
              if (status != 0)
                break;
            }
-         else if (strcasecmp (response, "FLAGS") == 0)
+         else if (mu_c_strcasecmp (response, "FLAGS") == 0)
            {
              /* Flags define on the mailbox not a message flags.  */
              status = imap_permanentflags (f_imap, &remainder);
            }
-         else if (strcasecmp (response, "LIST") == 0)
+         else if (mu_c_strcasecmp (response, "LIST") == 0)
            {
              status = imap_list (f_imap);
            }
-         else if (strcasecmp (response, "LSUB") == 0)
+         else if (mu_c_strcasecmp (response, "LSUB") == 0)
            {
              status = imap_list (f_imap);
            }
-         else if (strcasecmp (remainder, "RECENT") == 0)
+         else if (mu_c_strcasecmp (remainder, "RECENT") == 0)
            {
              f_imap->selected->recent = strtol (response, NULL, 10);
            }
-         else if (strcasecmp (response, "SEARCH") == 0)
+         else if (mu_c_strcasecmp (response, "SEARCH") == 0)
            {
              status = imap_search (f_imap);
            }
-         else if (strcasecmp (response, "STATUS") == 0)
+         else if (mu_c_strcasecmp (response, "STATUS") == 0)
            {
              status = imap_status (f_imap);
            }
@@ -2569,13 +2570,13 @@ imap_parse (f_imap_t f_imap)
        {
          /* Every transaction ends with a tagged response.  */
          done = 1;
-         if (strcasecmp (response, "OK") == 0)
+         if (mu_c_strcasecmp (response, "OK") == 0)
            {
              /* Cool we are doing ok.  */
            }
-         else if (strcasecmp (response, "NO") == 0)
+         else if (mu_c_strcasecmp (response, "NO") == 0)
            {
-             if (strncasecmp (remainder, "LOGIN", 5) == 0)
+             if (mu_c_strncasecmp (remainder, "LOGIN", 5) == 0)
                {
                  mu_observable_t observable = NULL;
                  mu_folder_get_observable (f_imap->folder, &observable);
@@ -2583,7 +2584,7 @@ imap_parse (f_imap_t f_imap)
                                        NULL);
                  status = MU_ERR_AUTH_FAILURE;
                }
-             else if (strncasecmp (remainder, "LIST", 4) == 0)
+             else if (mu_c_strncasecmp (remainder, "LIST", 4) == 0)
                status = MU_ERR_NOENT;
              else
                status = MU_ERR_FAILURE;
diff --git a/libproto/mailer/smtp.c b/libproto/mailer/smtp.c
index da5e820..b9b108c 100644
--- a/libproto/mailer/smtp.c
+++ b/libproto/mailer/smtp.c
@@ -529,7 +529,7 @@ smtp_writer (void *iodata, char *buf)
 {
   smtp_t iop = iodata;
   int status;
-  if (strncasecmp (buf, "EHLO", 4) == 0)
+  if (mu_c_strncasecmp (buf, "EHLO", 4) == 0)
     status = smtp_writeline (iop, "%s %s\r\n", buf, iop->localhost);
   else
     status = smtp_writeline (iop, "%s\r\n", buf);
@@ -829,8 +829,8 @@ smtp_send_message (mu_mailer_t mailer, mu_message_t argmsg, 
mu_address_t argfrom
                status = smtp_writeline (smtp, ".%s", data);
                CHECK_ERROR (smtp, status);
              }
-           else if (strncasecmp (data, MU_HEADER_FCC,
-                                 sizeof (MU_HEADER_FCC) - 1))
+           else if (mu_c_strncasecmp (data, MU_HEADER_FCC,
+                                      sizeof (MU_HEADER_FCC) - 1))
              {
                status = smtp_writeline (smtp, "%s", data);
                CHECK_ERROR (smtp, status);
@@ -1138,9 +1138,9 @@ smtp_parse_ehlo_ack (smtp_t smtp)
       if (status == 0) {
        smtp->ptr = smtp->buffer;
 
-       if (!strncasecmp (smtp->buffer, "250-STARTTLS", 12))
+       if (!mu_c_strncasecmp (smtp->buffer, "250-STARTTLS", 12))
          smtp->capa |= CAPA_STARTTLS;
-       else if (!strncasecmp (smtp->buffer, "250-SIZE", 8))
+       else if (!mu_c_strncasecmp (smtp->buffer, "250-SIZE", 8))
          {
            smtp->capa |= CAPA_SIZE;
            if (smtp->buffer[8] == '=')
diff --git a/libproto/mbox/mbox.c b/libproto/mbox/mbox.c
index 37b980c..4dc0df2 100644
--- a/libproto/mbox/mbox.c
+++ b/libproto/mbox/mbox.c
@@ -1550,11 +1550,11 @@ mbox_append_message0 (mu_mailbox_t mailbox, 
mu_message_t msg, mu_off_t *psize,
               FIXME:
               - We have a problem here the header may not fit the buffer.
               - Should  we skip the IMAP "X-Status"? */
-           if ((strncasecmp (buffer, "Status", 6) == 0)
-               || (strncasecmp (buffer, "X-IMAPbase", 10) == 0)
+           if ((mu_c_strncasecmp (buffer, "Status", 6) == 0)
+               || (mu_c_strncasecmp (buffer, "X-IMAPbase", 10) == 0)
                /* FIXME: isn't the length of "X-UID" 5, not 4? And
                 this will match X-UID and X-UIDL, is this intended? */
-               || (strncasecmp (buffer, "X-UID", 4) == 0
+               || (mu_c_strncasecmp (buffer, "X-UID", 4) == 0
                    && (buffer[5] == ':' || buffer[5] == ' '
                        || buffer[5] == '\t')))
              continue;
diff --git a/libproto/pop/folder.c b/libproto/pop/folder.c
index f80f6db..538938c 100644
--- a/libproto/pop/folder.c
+++ b/libproto/pop/folder.c
@@ -34,6 +34,7 @@
 #include <mailutils/auth.h>
 #include <mailutils/errno.h>
 #include <mailutils/mailbox.h>
+#include <mailutils/mutil.h>
 
 #include <folder0.h>
 #include <registrar0.h>
@@ -131,7 +132,7 @@ folder_pop_get_authority (mu_folder_t folder, 
mu_authority_t *pauth)
        return EINVAL;
 
       if (folder->url->auth == NULL
-         || strcasecmp (folder->url->auth, "*") == 0)
+         || mu_c_strcasecmp (folder->url->auth, "*") == 0)
        {
          status = mu_authority_create (&folder->authority, NULL, folder);
          mu_authority_set_authenticate (folder->authority, _pop_user, folder);
@@ -141,7 +142,7 @@ folder_pop_get_authority (mu_folder_t folder, 
mu_authority_t *pauth)
        Anything else starting with "+" is an extension mechanism.
        Without a "+" it's a SASL mechanism.
       */
-      else if (strcasecmp (folder->url->auth, "+APOP") == 0)
+      else if (mu_c_strcasecmp (folder->url->auth, "+APOP") == 0)
        {
          status = mu_authority_create (&folder->authority, NULL, folder);
          mu_authority_set_authenticate (folder->authority, _pop_apop, folder);
diff --git a/libproto/pop/mbox.c b/libproto/pop/mbox.c
index 655af16..4642f02 100644
--- a/libproto/pop/mbox.c
+++ b/libproto/pop/mbox.c
@@ -55,6 +55,7 @@
 #include <mailutils/tls.h>
 #include <mailutils/md5.h>
 #include <mailutils/io.h>
+#include <mailutils/mutil.h>
 
 #include <folder0.h>
 #include <mailbox0.h>
@@ -424,7 +425,7 @@ static int
 pop_parse_capa (pop_data_t mpd)
 {
   int status;
-  if (!strncasecmp (mpd->buffer, "+OK", 3))
+  if (!mu_c_strncasecmp (mpd->buffer, "+OK", 3))
     {
       mpd->capa = 0;
       do
@@ -443,13 +444,13 @@ pop_parse_capa (pop_data_t mpd)
             Note that there is no APOP capability, even though APOP
             is an optional command in POP3. -- W.P. */
 
-         if (!strncasecmp (mpd->buffer, "TOP", 3))
+         if (!mu_c_strncasecmp (mpd->buffer, "TOP", 3))
            mpd->capa |= CAPA_TOP;
-         else if (!strncasecmp (mpd->buffer, "USER", 4))
+         else if (!mu_c_strncasecmp (mpd->buffer, "USER", 4))
            mpd->capa |= CAPA_USER;
-         else if (!strncasecmp (mpd->buffer, "UIDL", 4))
+         else if (!mu_c_strncasecmp (mpd->buffer, "UIDL", 4))
            mpd->capa |= CAPA_UIDL;
-         else if (!strncasecmp (mpd->buffer, "STLS", 4))
+         else if (!mu_c_strncasecmp (mpd->buffer, "STLS", 4))
            mpd->capa |= CAPA_STLS;
        }
       while (mpd->nl);
@@ -525,7 +526,7 @@ _pop_user (mu_authority_t auth)
       status = pop_read_ack (mpd);
       CHECK_EAGAIN (mpd, status);
       MU_DEBUG (mbox->debug, MU_DEBUG_PROT, mpd->buffer);
-      if (strncasecmp (mpd->buffer, "+OK", 3) != 0)
+      if (mu_c_strncasecmp (mpd->buffer, "+OK", 3) != 0)
        {
          mu_observable_t observable = NULL;
          mu_mailbox_get_observable (mbox, &observable);
@@ -564,7 +565,7 @@ _pop_user (mu_authority_t auth)
       status = pop_read_ack (mpd);
       CHECK_EAGAIN (mpd, status);
       MU_DEBUG (mbox->debug, MU_DEBUG_PROT, mpd->buffer);
-      if (strncasecmp (mpd->buffer, "+OK", 3) != 0)
+      if (mu_c_strncasecmp (mpd->buffer, "+OK", 3) != 0)
        {
          mu_observable_t observable = NULL;
          mu_mailbox_get_observable (mbox, &observable);
@@ -636,7 +637,7 @@ _pop_apop (mu_authority_t auth)
       status = pop_read_ack (mpd);
       CHECK_EAGAIN (mpd, status);
       MU_DEBUG (mbox->debug, MU_DEBUG_PROT, mpd->buffer);
-      if (strncasecmp (mpd->buffer, "+OK", 3) != 0)
+      if (mu_c_strncasecmp (mpd->buffer, "+OK", 3) != 0)
         {
           mu_observable_t observable = NULL;
           mu_mailbox_get_observable (mbox, &observable);
@@ -666,7 +667,7 @@ pop_reader (void *iodata)
   status = pop_read_ack (iop);
   CHECK_EAGAIN (iop, status);
   MU_DEBUG (iop->mbox->debug, MU_DEBUG_PROT, iop->buffer);
-  return status;//strncasecmp (iop->buffer, "+OK", 3) == 0;
+  return status;/*mu_c_strncasecmp (iop->buffer, "+OK", 3) == 0;*/
 }
 
 static int
@@ -822,7 +823,7 @@ pop_open (mu_mailbox_t mbox, int flags)
        status = pop_read_ack (mpd);
        CHECK_EAGAIN (mpd, status);
        MU_DEBUG (mbox->debug, MU_DEBUG_PROT, mpd->buffer);
-       if (strncasecmp (mpd->buffer, "+OK", 3) != 0)
+       if (mu_c_strncasecmp (mpd->buffer, "+OK", 3) != 0)
          {
            CHECK_ERROR_CLOSE (mbox, mpd, EACCES);
          }
@@ -918,7 +919,7 @@ pop_close (mu_mailbox_t mbox)
       /*  Now what ! and how can we tell them about errors ?  So far now
          lets just be verbose about the error but close the connection
          anyway.  */
-      if (strncasecmp (mpd->buffer, "+OK", 3) != 0)
+      if (mu_c_strncasecmp (mpd->buffer, "+OK", 3) != 0)
        mu_error ("pop_close: %s\n", mpd->buffer);
       mu_stream_close (mbox->stream);
       break;
@@ -1318,7 +1319,7 @@ pop_expunge (mu_mailbox_t mbox)
                  status = pop_read_ack (mpd);
                  CHECK_EAGAIN (mpd, status);
                  MU_DEBUG (mbox->debug, MU_DEBUG_PROT, mpd->buffer);
-                 if (strncasecmp (mpd->buffer, "+OK", 3) != 0)
+                 if (mu_c_strncasecmp (mpd->buffer, "+OK", 3) != 0)
                    {
                      CHECK_ERROR (mpd, ERANGE);
                    }
@@ -1735,7 +1736,7 @@ pop_top (mu_header_t header, char *buffer, size_t buflen,
       status = pop_read_ack (mpd);
       CHECK_EAGAIN (mpd, status);
       MU_DEBUG (mpd->mbox->debug, MU_DEBUG_PROT, mpd->buffer);
-      /* if (strncasecmp (mpd->buffer, "+OK", 3) != 0)
+      /* if (mu_c_strncasecmp (mpd->buffer, "+OK", 3) != 0)
           mu_error ("TOP not implemented\n"); */ /* FIXME */
       mpd->state = POP_TOP_RX;
 
@@ -1954,7 +1955,7 @@ pop_retr (pop_message_t mpm, char *buffer, size_t buflen,
       CHECK_EAGAIN (mpd, status);
       MU_DEBUG (mpd->mbox->debug, MU_DEBUG_PROT, mpd->buffer);
 
-      if (strncasecmp (mpd->buffer, "+OK", 3) != 0)
+      if (mu_c_strncasecmp (mpd->buffer, "+OK", 3) != 0)
        {
          CHECK_ERROR (mpd, EACCES);
        }
diff --git a/libproto/pop/pop3_connect.c b/libproto/pop/pop3_connect.c
index 2818ab0..75376d6 100644
--- a/libproto/pop/pop3_connect.c
+++ b/libproto/pop/pop3_connect.c
@@ -81,7 +81,7 @@ mu_pop3_connect (mu_pop3_t pop3)
        status = mu_pop3_response (pop3, NULL, 0, &len);
        MU_POP3_CHECK_EAGAIN (pop3, status);
        mu_pop3_debug_ack (pop3);
-       if (strncasecmp (pop3->ack.buf, "+OK", 3) != 0)
+       if (mu_c_strncasecmp (pop3->ack.buf, "+OK", 3) != 0)
          {
            mu_stream_close (pop3->carrier);
            pop3->state = MU_POP3_NO_STATE;
diff --git a/maidag/lmtp.c b/maidag/lmtp.c
index ed33a61..ace1051 100644
--- a/maidag/lmtp.c
+++ b/maidag/lmtp.c
@@ -486,7 +486,7 @@ getcmd (char *buf, char **sp)
   for (cp = command_tab; cp->cmd_verb; cp++)
     {
       if (cp->cmd_len <= len
-         && strncasecmp (cp->cmd_verb, buf, cp->cmd_len) == 0)
+         && mu_c_strncasecmp (cp->cmd_verb, buf, cp->cmd_len) == 0)
        {
          *sp = buf + cp->cmd_len;
          return cp;
diff --git a/maidag/maidag.c b/maidag/maidag.c
index 460deda..1ac167e 100644
--- a/maidag/maidag.c
+++ b/maidag/maidag.c
@@ -325,7 +325,7 @@ cb2_forward_file_checks (mu_debug_t debug, const char 
*name, void *data)
   const char *str;
   int val;
   
-  if (strlen (name) > 2 && strncasecmp (name, "no", 2) == 0)
+  if (strlen (name) > 2 && mu_c_strncasecmp (name, "no", 2) == 0)
     {
       negate = 1;
       str = name + 2;
diff --git a/maidag/mailquota.c b/maidag/mailquota.c
index faa4082..bcad098 100644
--- a/maidag/mailquota.c
+++ b/maidag/mailquota.c
@@ -106,9 +106,9 @@ dbm_retrieve_quota (char *name, mu_off_t *quota)
        return RETR_FAILURE;
     }
 
-  if (strncasecmp("none",
-                 MU_DATUM_PTR (contentd),
-                 MU_DATUM_SIZE (contentd)) == 0) 
+  if (mu_c_strncasecmp("none",
+                      MU_DATUM_PTR (contentd),
+                      MU_DATUM_SIZE (contentd)) == 0) 
       unlimited = 1;
   else if (MU_DATUM_SIZE (contentd) > sizeof(buffer)-1)
     {
@@ -229,7 +229,7 @@ sql_retrieve_quota (char *name, mu_off_t *quota)
                    mu_strerror (status));
          rc = RETR_FAILURE;
        }
-      else if (tmp == NULL || tmp[0] == 0 || strcasecmp (tmp, "none") == 0)
+      else if (tmp == NULL || tmp[0] == 0 || mu_c_strcasecmp (tmp, "none") == 
0)
        rc = RETR_UNLIMITED;
       else
        {
diff --git a/mail/alt.c b/mail/alt.c
index 76629c8..e658973 100644
--- a/mail/alt.c
+++ b/mail/alt.c
@@ -79,9 +79,9 @@ mail_set_my_name (char *name)
 int
 mail_is_my_name (const char *name)
 {
-  if (strchr(name, '@') == NULL && strcasecmp (name, my_name) == 0)
+  if (strchr(name, '@') == NULL && mu_c_strcasecmp (name, my_name) == 0)
     return 1;
-  if (strcasecmp (name, my_email) == 0)
+  if (mu_c_strcasecmp (name, my_email) == 0)
     return 1;
   return util_slist_lookup (alternate_names, name);
 }
diff --git a/mail/decode.c b/mail/decode.c
index 58f66b4..d9b0cf7 100644
--- a/mail/decode.c
+++ b/mail/decode.c
@@ -175,7 +175,7 @@ display_message0 (mu_message_t mesg, const msgset_t *msgset,
            }
        }
     }
-  else if (strncasecmp (type, "message/rfc822", strlen (type)) == 0)
+  else if (mu_c_strncasecmp (type, "message/rfc822", strlen (type)) == 0)
     {
       mu_message_t submsg = NULL;
 
diff --git a/mail/util.c b/mail/util.c
index 5a5b8ca..3c5d039 100644
--- a/mail/util.c
+++ b/mail/util.c
@@ -879,7 +879,7 @@ util_slist_lookup (mu_list_t list, const char *str)
   for (mu_iterator_first (itr); !mu_iterator_is_done (itr); mu_iterator_next 
(itr))
     {
       mu_iterator_current (itr, (void **)&name);
-      if (strcasecmp (name, str) == 0)
+      if (mu_c_strcasecmp (name, str) == 0)
        {
          rc = 1;
          break;
@@ -1110,7 +1110,7 @@ util_descend_subparts (mu_message_t mesg, msgset_t 
*msgset, mu_message_t *part)
 
       mu_message_get_header (mesg, &hdr);
       util_get_content_type (hdr, &type);
-      if (strncasecmp (type, "message/rfc822", strlen (type)) == 0)
+      if (mu_c_strncasecmp (type, "message/rfc822", strlen (type)) == 0)
        {
          if (mu_message_unencapsulate (mesg, &submsg, NULL))
            {
@@ -1239,7 +1239,7 @@ is_address_field (const char *name)
   char **p;
   
   for (p = address_fields; *p; p++)
-    if (strcasecmp (*p, name) == 0)
+    if (mu_c_strcasecmp (*p, name) == 0)
       return 1;
   return 0;
 }
@@ -1416,7 +1416,7 @@ util_rfc2047_decode (char **value)
   if (!*value || util_getenv (&charset, "charset", Mail_env_string, 0))
     return;
 
-  if (strcasecmp (charset, "auto") == 0)
+  if (mu_c_strcasecmp (charset, "auto") == 0)
     {
       memset (locale, 0, sizeof (locale));
 
diff --git a/mailbox/address.c b/mailbox/address.c
index 8c81f45..7a06696 100644
--- a/mailbox/address.c
+++ b/mailbox/address.c
@@ -519,7 +519,7 @@ int
 mu_address_contains_email (mu_address_t addr, const char *email)
 {
   for (; addr; addr = addr->next)
-    if (strcasecmp (addr->email, email) == 0)
+    if (mu_c_strcasecmp (addr->email, email) == 0)
       return 1;
   return 0;
 }
diff --git a/mailbox/amd.c b/mailbox/amd.c
index 27850f0..ebf9c97 100644
--- a/mailbox/amd.c
+++ b/mailbox/amd.c
@@ -665,11 +665,13 @@ _amd_message_save (struct _amd_data *amd, struct 
_amd_message *mhm,
       if (_amd_delim (buf))
        break;
 
-      if (!(strncasecmp (buf, "status:", 7) == 0
-           || strncasecmp (buf, "x-imapbase:", 11) == 0
-           || strncasecmp (buf, "x-uid:", 6) == 0
-           || strncasecmp (buf, MU_HEADER_ENV_DATE ":", sizeof 
(MU_HEADER_ENV_DATE)) == 0
-           || strncasecmp (buf, MU_HEADER_ENV_SENDER ":", sizeof 
(MU_HEADER_ENV_SENDER)) == 0))
+      if (!(mu_c_strncasecmp (buf, "status:", 7) == 0
+           || mu_c_strncasecmp (buf, "x-imapbase:", 11) == 0
+           || mu_c_strncasecmp (buf, "x-uid:", 6) == 0
+           || mu_c_strncasecmp (buf, 
+                MU_HEADER_ENV_DATE ":", sizeof (MU_HEADER_ENV_DATE)) == 0
+           || mu_c_strncasecmp (buf, 
+                MU_HEADER_ENV_SENDER ":", sizeof (MU_HEADER_ENV_SENDER)) == 0))
        {
          nlines++;
          nbytes += fprintf (fp, "%s", buf);
@@ -1338,13 +1340,13 @@ amd_scan_message (struct _amd_message *mhm)
            hlines++;
 
          /* Process particular attributes */
-         if (strncasecmp (buf, "status:", 7) == 0)
+         if (mu_c_strncasecmp (buf, "status:", 7) == 0)
            {
              int deleted = mhm->attr_flags & MU_ATTRIBUTE_DELETED;
              mu_string_to_flags (buf, &mhm->attr_flags);
              mhm->attr_flags |= deleted;
            }
-         else if (strncasecmp (buf, "x-imapbase:", 11) == 0)
+         else if (mu_c_strncasecmp (buf, "x-imapbase:", 11) == 0)
            {
              char *p;
              mhm->amd->uidvalidity = strtoul (buf + 11, &p, 10);
diff --git a/mailbox/assoc.c b/mailbox/assoc.c
index 6b53e86..e47877a 100644
--- a/mailbox/assoc.c
+++ b/mailbox/assoc.c
@@ -27,6 +27,7 @@
 #include <mailutils/errno.h>
 #include <mailutils/error.h>
 #include <mailutils/iterator.h>
+#include <mailutils/mutil.h>
 #include <iterator0.h>
 
 /* |hash_size| defines a sequence of symbol table sizes. These are prime
@@ -177,7 +178,7 @@ assoc_remove (mu_assoc_t assoc, struct _mu_assoc_elem *elem)
 }
 
 #define name_cmp(assoc,a,b) (((assoc)->flags & MU_ASSOC_ICASE) ? \
-                             strcasecmp(a,b) : strcmp(a,b))
+                             mu_c_strcasecmp(a,b) : strcmp(a,b))
 
 static int
 assoc_lookup_or_install (struct _mu_assoc_elem **elp,
diff --git a/mailbox/attachment.c b/mailbox/attachment.c
index 5501156..0951224 100644
--- a/mailbox/attachment.c
+++ b/mailbox/attachment.c
@@ -42,6 +42,7 @@
 #include <mailutils/message.h>
 #include <mailutils/stream.h>
 #include <mailutils/errno.h>
+#include <mailutils/mutil.h>

 #define MAX_HDR_LEN 256
 #define BUF_SIZE       2048
@@ -217,7 +218,7 @@ _header_get_param (char *field_body, const char *param, 
size_t * len)
            (*len)++;
          e++;
        }
-      if (strncasecmp (p, param, strlen (param)))
+      if (mu_c_strncasecmp (p, param, strlen (param)))
        {                       /* no match jump to next */
          p = strchr (e, ';');
          continue;
@@ -494,8 +495,8 @@ mu_message_unencapsulate (mu_message_t msg, mu_message_t * 
newmsg, void **data)
          if ((content_type = malloc (size + 1)) == NULL)
            return ENOMEM;
          mu_header_get_value (hdr, "Content-Type", content_type, size + 1, 0);
-         ret = strncasecmp (content_type, "message/rfc822",
-                            strlen ("message/rfc822"));
+         ret = mu_c_strncasecmp (content_type, "message/rfc822",
+                                 strlen ("message/rfc822"));
           free (content_type);
           if (ret != 0)
            return EINVAL;
diff --git a/mailbox/attribute.c b/mailbox/attribute.c
index b5c03ec..682ddab 100644
--- a/mailbox/attribute.c
+++ b/mailbox/attribute.c
@@ -417,7 +417,7 @@ mu_string_to_flags (const char *buffer, int *pflags)
     return EINVAL;
 
   /* Set the attribute */
-  if (strncasecmp (buffer, "Status:", 7) == 0)
+  if (mu_c_strncasecmp (buffer, "Status:", 7) == 0)
     {
       sep = strchr(buffer, ':'); /* pass the ':' */
       sep++;
diff --git a/mailbox/date.c b/mailbox/date.c
index 7f5067b..fe1c71a 100644
--- a/mailbox/date.c
+++ b/mailbox/date.c
@@ -145,7 +145,7 @@ mu_parse_imap_date_time (const char **p, struct tm *tm, 
mu_timezone *tz)
 
   for (i = 0; i < 12; i++)
     {
-      if (strncasecmp (month, months[i], 3) == 0)
+      if (mu_c_strncasecmp (month, months[i], 3) == 0)
        {
          mon = i;
          break;
@@ -203,7 +203,7 @@ mu_parse_ctime_date_time (const char **p, struct tm *tm, 
mu_timezone * tz)
 
   for (i = 0; i < 7; i++)
     {
-      if (strncasecmp (weekday, wdays[i], 3) == 0)
+      if (mu_c_strncasecmp (weekday, wdays[i], 3) == 0)
        {
          wday = i;
          break;
@@ -212,7 +212,7 @@ mu_parse_ctime_date_time (const char **p, struct tm *tm, 
mu_timezone * tz)
 
   for (i = 0; i < 12; i++)
     {
-      if (strncasecmp (month, months[i], 3) == 0)
+      if (mu_c_strncasecmp (month, months[i], 3) == 0)
        {
          mon = i;
          break;
diff --git a/mailbox/filter.c b/mailbox/filter.c
index e72fa6f..17d9ccc 100644
--- a/mailbox/filter.c
+++ b/mailbox/filter.c
@@ -39,6 +39,7 @@ First draft: Alain Magloire.
 #include <mailutils/iterator.h>
 #include <mailutils/stream.h>
 #include <mailutils/errno.h>
+#include <mailutils/mutil.h>
 
 static void
 filter_destroy (mu_stream_t stream)
@@ -188,7 +189,7 @@ mu_filter_create (mu_stream_t *pstream, mu_stream_t stream, 
const char *name,
       mu_iterator_current (iterator, (void **)&filter_record);
       if ((filter_record->_is_filter
           && filter_record->_is_filter (filter_record, name))
-         || (strcasecmp (filter_record->name, name) == 0))
+         || (mu_c_strcasecmp (filter_record->name, name) == 0))
         {
          found = 1;
          if (filter_record->_get_filter)
diff --git a/mailbox/header.c b/mailbox/header.c
index 5f805f7..8606863 100644
--- a/mailbox/header.c
+++ b/mailbox/header.c
@@ -79,13 +79,13 @@ mu_hdrent_find (struct _mu_header *hdr, const char *name, 
int pos)
   if (pos > 0)
     {
       for (p = hdr->head; p; p = p->next)
-       if (strcasecmp (MU_HDRENT_NAME (hdr,p), name) == 0 && pos-- == 1)
+       if (mu_c_strcasecmp (MU_HDRENT_NAME (hdr,p), name) == 0 && pos-- == 1)
          break;
     }
   else if (pos < 0)
     {
       for (p = hdr->tail; p; p = p->prev)
-       if (strcasecmp (MU_HDRENT_NAME (hdr,p), name) == 0 && ++pos == 0)
+       if (mu_c_strcasecmp (MU_HDRENT_NAME (hdr,p), name) == 0 && ++pos == 0)
          break;
     }
   else
diff --git a/mailbox/kwd.c b/mailbox/kwd.c
index 31eea19..0450c1b 100644
--- a/mailbox/kwd.c
+++ b/mailbox/kwd.c
@@ -22,6 +22,7 @@
 #include <string.h>
 #include <mailutils/kwd.h>
 #include <mailutils/errno.h>
+#include <mailutils/mutil.h>
 
 int
 mu_kwd_xlat_name_len (mu_kwd_t *kwtab, const char *str, size_t len, int *pres)
@@ -45,7 +46,7 @@ mu_kwd_xlat_name_len_ci (mu_kwd_t *kwtab, const char *str, 
size_t len,
   for (; kwtab->name; kwtab++)
     {
       size_t kwlen = strlen (kwtab->name);
-      if (kwlen == len && strncasecmp (kwtab->name, str, len) == 0)
+      if (kwlen == len && mu_c_strncasecmp (kwtab->name, str, len) == 0)
        {
          *pres = kwtab->tok;
          return 0;
@@ -70,7 +71,7 @@ int
 mu_kwd_xlat_name_ci (mu_kwd_t *kwtab, const char *str, int *pres)
 {
   for (; kwtab->name; kwtab++)
-    if (strcasecmp (kwtab->name, str) == 0)
+    if (mu_c_strcasecmp (kwtab->name, str) == 0)
       {
        *pres = kwtab->tok;
        return 0;
diff --git a/mailbox/locale.c b/mailbox/locale.c
index 5420319..111dd57 100644
--- a/mailbox/locale.c
+++ b/mailbox/locale.c
@@ -22,6 +22,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <mailutils/mutil.h>
 
 struct langtab
 {
@@ -230,10 +231,10 @@ mu_charset_lookup (char *lang, char *terr)
   if (!lang)
     return NULL;
   for (p = langtab; p->lang; p++)
-    if (strcasecmp (p->lang, lang) == 0
+    if (mu_c_strcasecmp (p->lang, lang) == 0
        && (terr == NULL 
            || p->terr == NULL
-           || !strcasecmp (p->terr, terr) == 0))
+           || !mu_c_strcasecmp (p->terr, terr) == 0))
       return p->charset;
   return NULL;
 }
diff --git a/mailbox/mailcap.c b/mailbox/mailcap.c
index f217c61..0509c47 100644
--- a/mailbox/mailcap.c
+++ b/mailbox/mailcap.c
@@ -27,6 +27,7 @@
 
 #include <mailutils/mailcap.h>
 #include <mailutils/stream.h>
+#include <mailutils/mutil.h>
 
 /* Definition of the structure, this should be in mailutils/sys/mailcap.h.  */
 struct _mu_mailcap_entry
@@ -299,7 +300,7 @@ mu_mailcap_entry_needsterminal (mu_mailcap_entry_t entry, 
int *on)
       int i;
       for (i = 0; i < entry->fields_count; i++)
        {
-         int n = strcasecmp (entry->fields[i], "needsterminal");
+         int n = mu_c_strcasecmp (entry->fields[i], "needsterminal");
          if (n == 0)
            {
              found = 1;
@@ -326,7 +327,7 @@ mu_mailcap_entry_copiousoutput (mu_mailcap_entry_t entry, 
int *on)
       int i;
       for (i = 0; i < entry->fields_count; i++)
        {
-         int n = strcasecmp (entry->fields[i], "copiousoutput");
+         int n = mu_c_strcasecmp (entry->fields[i], "copiousoutput");
          if (n == 0)
            {
              found = 1;
@@ -354,7 +355,7 @@ mu_mailcap_entry_get_value (mu_mailcap_entry_t entry, const 
char *key,
       int key_len = strlen (key);
       for (i = 0; i < entry->fields_count; i++)
        {
-         int n = strncasecmp (entry->fields[i], key, key_len);
+         int n = mu_c_strncasecmp (entry->fields[i], key, key_len);
          if (n == 0)
            {
              int field_len = strlen(entry->fields[i]);
diff --git a/mailbox/mailer.c b/mailbox/mailer.c
index 33cd37c..175b579 100644
--- a/mailbox/mailer.c
+++ b/mailbox/mailer.c
@@ -304,7 +304,7 @@ save_fcc (mu_message_t msg)
       mu_mailbox_t mbox;
       
       mu_header_get_field_name (hdr, i, buf, sizeof buf, NULL);
-      if (strcasecmp (buf, MU_HEADER_FCC) == 0
+      if (mu_c_strcasecmp (buf, MU_HEADER_FCC) == 0
          && mu_header_aget_field_value (hdr, i, &fcc) == 0)
        {
          int i, argc;
@@ -461,15 +461,15 @@ merge_headers (mu_message_t newmsg, mu_header_t hdr)
 
       mu_header_sget_field_name (hdr, i, &fn);
       mu_header_sget_field_value (hdr, i, &fv);
-      if (strcasecmp (fn, MU_HEADER_MESSAGE_ID) == 0)
+      if (mu_c_strcasecmp (fn, MU_HEADER_MESSAGE_ID) == 0)
        continue;
-      else if (strcasecmp (fn, MU_HEADER_MIME_VERSION) == 0)
+      else if (mu_c_strcasecmp (fn, MU_HEADER_MIME_VERSION) == 0)
        mu_header_append (newhdr, "X-Orig-" MU_HEADER_MIME_VERSION,
                          fv);
-      else if (strcasecmp (fn, MU_HEADER_CONTENT_TYPE) == 0)
+      else if (mu_c_strcasecmp (fn, MU_HEADER_CONTENT_TYPE) == 0)
        mu_header_append (newhdr, "X-Orig-" MU_HEADER_CONTENT_TYPE,
                          fv);
-      else if (strcasecmp (fn, MU_HEADER_CONTENT_DESCRIPTION) == 0)
+      else if (mu_c_strcasecmp (fn, MU_HEADER_CONTENT_DESCRIPTION) == 0)
        mu_header_append (newhdr, "X-Orig-" MU_HEADER_CONTENT_DESCRIPTION,
                          fv);
       else
diff --git a/mailbox/message_stream.c b/mailbox/message_stream.c
index 066d789..119ab80 100644
--- a/mailbox/message_stream.c
+++ b/mailbox/message_stream.c
@@ -265,16 +265,16 @@ restore_envelope (mu_stream_t str, struct 
_mu_rfc822_message **pmenv)
 
       if (!env_from || !env_date)
        {
-         if (!from && strncasecmp (buffer, MU_HEADER_FROM,
-                                   sizeof (MU_HEADER_FROM) - 1) == 0)
+         if (!from && mu_c_strncasecmp (buffer, MU_HEADER_FROM,
+                                        sizeof (MU_HEADER_FROM) - 1) == 0)
            from = strdup (skipws (buffer, sizeof (MU_HEADER_FROM)));
          else if (!env_from
-                  && strncasecmp (buffer, MU_HEADER_ENV_SENDER,
-                                  sizeof (MU_HEADER_ENV_SENDER) - 1) == 0)
+                  && mu_c_strncasecmp (buffer, MU_HEADER_ENV_SENDER,
+                                       sizeof (MU_HEADER_ENV_SENDER) - 1) == 0)
            env_from = strdup (skipws (buffer, sizeof (MU_HEADER_ENV_SENDER)));
          else if (!env_date
-                  && strncasecmp (buffer, MU_HEADER_ENV_DATE,
-                                  sizeof (MU_HEADER_ENV_DATE) - 1) == 0)
+                  && mu_c_strncasecmp (buffer, MU_HEADER_ENV_DATE,
+                                       sizeof (MU_HEADER_ENV_DATE) - 1) == 0)
            env_date = strdup (skipws (buffer, sizeof (MU_HEADER_ENV_DATE)));
        }
     }
diff --git a/mailbox/mime.c b/mailbox/mime.c
index d217826..d0bc6d8 100644
--- a/mailbox/mime.c
+++ b/mailbox/mime.c
@@ -37,6 +37,7 @@
 #include <mailutils/body.h>
 #include <mailutils/header.h>
 #include <mailutils/errno.h>
+#include <mailutils/mutil.h>
 #include <mime0.h>
 
 #ifndef TRUE
@@ -53,7 +54,7 @@ static int
 _mime_is_multipart_digest (mu_mime_t mime)
 {
   if (mime->content_type)
-    return (strncasecmp
+    return (mu_c_strncasecmp
            ("multipart/digest", mime->content_type,
             strlen ("multipart/digest")) ? 0 : 1);
   return 0;
@@ -226,7 +227,7 @@ _mime_get_param (char *field_body, const char *param, int 
*len)
            (*len)++;
          e++;
        }
-      if (strncasecmp (p, param, strlen (param)))
+      if (mu_c_strncasecmp (p, param, strlen (param)))
        {                       /* no match jump to next */
          p = strchr (e, ';');
          continue;
@@ -328,10 +329,10 @@ _mime_parse_mpart_message (mu_mime_t mime)
                    '\n' ? mime->cur_line + 1 : mime->cur_line;
                  if (mime->line_ndx >= blength)
                    {
-                     if ((!strncasecmp (cp2, "--", 2)
-                          && !strncasecmp (cp2 + 2, mime->boundary,
-                                           blength))
-                         || !strncasecmp (cp2, mime->boundary, blength))
+                     if ((!mu_c_strncasecmp (cp2, "--", 2)
+                          && !mu_c_strncasecmp (cp2 + 2, mime->boundary,
+                                                blength))
+                         || !mu_c_strncasecmp (cp2, mime->boundary, blength))
                        {
                          mime->parser_state = MIME_STATE_HEADERS;
                          mime->flags &= ~MIME_PARSER_HAVE_CR;
@@ -365,10 +366,10 @@ _mime_parse_mpart_message (mu_mime_t mime)
 
                          if ((&mime->cur_line[mime->line_ndx] - cp2 - 1 >
                               blength
-                              && !strncasecmp (cp2 + blength + 2, "--", 2))
+                              && !mu_c_strncasecmp (cp2 + blength + 2, "--", 
2))
                              || (&mime->cur_line[mime->line_ndx] - cp2 - 1 ==
                                  blength
-                                 && !strncasecmp (cp2 + blength, "--", 2)))
+                                 && !mu_c_strncasecmp (cp2 + blength, "--", 
2)))
                            {   /* last boundary */
                              mime->parser_state = MIME_STATE_BEGIN_LINE;
                              mime->header_length = 0;
@@ -1027,7 +1028,7 @@ int
 mu_mime_is_multipart (mu_mime_t mime)
 {
   if (mime->content_type)
-    return (strncasecmp ("multipart", mime->content_type,
-                        strlen ("multipart")) ? 0 : 1);
+    return (mu_c_strncasecmp ("multipart", mime->content_type,
+                             strlen ("multipart")) ? 0 : 1);
   return 0;
 }
diff --git a/mailbox/mutil.c b/mailbox/mutil.c
index 69729da..64ff2da 100644
--- a/mailbox/mutil.c
+++ b/mailbox/mutil.c
@@ -1354,7 +1354,7 @@ mu_decode_filter (mu_stream_t *pfilter, mu_stream_t input,
   if (status)
     return status;
 
-  if (fromcode && tocode && strcasecmp (fromcode, tocode))
+  if (fromcode && tocode && mu_c_strcasecmp (fromcode, tocode))
     {
       mu_stream_t cvt;
       status = mu_filter_iconv_create (&cvt, filter, fromcode, tocode,
@@ -1521,3 +1521,58 @@ mu_stream_flags_to_mode (int flags, int isdir)
   
   return mode;
 }
+
+static char c_coltab[] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  ' ', '!', '"', '#', '$', '%', '&', '\'',
+  '(', ')', '*', '+', ',', '-', '.', '/',
+  '0', '1', '2', '3', '4', '5', '6', '7',
+  '8', '9', ':', ';', '<', '=', '>', '?',
+  '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
+  'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+  'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+  'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
+  '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
+  'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+  'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+  'X', 'Y', 'Z', '{', '|', '}', '~'
+};
+
+#define c_colsiz (sizeof(c_coltab) / sizeof(c_coltab[0]))
+
+int
+mu_c_strcasecmp (const char *a, const char *b)
+{
+  int d = 0;
+  for (; d == 0; a++, b++)
+    {
+      unsigned ac = *(unsigned char*) a;
+      unsigned bc = *(unsigned char*) b;
+      if (ac == 0 || bc == 0) 
+       return ac - bc;
+      if (ac > c_colsiz || bc > c_colsiz)
+       d = ac - bc;
+      d = c_coltab[ac] - c_coltab[bc];
+    }
+  return d;
+}
+                       
+int
+mu_c_strncasecmp (const char *a, const char *b, size_t n)
+{
+  int d = 0;
+  for (; d == 0 && n > 0; a++, b++, n--)
+    {
+      unsigned ac = *(unsigned char*) a;
+      unsigned bc = *(unsigned char*) b;
+      if (ac == 0 || bc == 0)
+       return ac - bc;
+      if (ac > c_colsiz || bc > c_colsiz)
+       d = ac - bc;
+      d = c_coltab[ac] - c_coltab[bc];
+    }
+  return d;
+}
diff --git a/mailbox/parse822.c b/mailbox/parse822.c
index 837fe6b..67ef0fe 100644
--- a/mailbox/parse822.c
+++ b/mailbox/parse822.c
@@ -1509,7 +1509,7 @@ mu_parse822_day (const char **p, const char *e, int *day)
 
   for (d = 0; days[d]; d++)
     {
-      if (strncasecmp (*p, days[d], 3) == 0)
+      if (mu_c_strncasecmp (*p, days[d], 3) == 0)
        {
          *p += 3;
          if (day)
@@ -1566,7 +1566,7 @@ mu_parse822_date (const char **p, const char *e, int 
*day, int *mon, int *year)
 
   for (m = 0; mons[m]; m++)
     {
-      if (strncasecmp (*p, mons[m], 3) == 0)
+      if (mu_c_strncasecmp (*p, mons[m], 3) == 0)
        {
          *p += 3;
          if (mon)
@@ -1701,7 +1701,7 @@ mu_parse822_time (const char **p, const char *e,
   /* see if it's a timezone */
   for (; tzs[z].tzname; z++)
     {
-      if (strcasecmp (zone, tzs[z].tzname) == 0)
+      if (mu_c_strcasecmp (zone, tzs[z].tzname) == 0)
        break;
     }
   if (tzs[z].tzname)
diff --git a/mailbox/progmailer.c b/mailbox/progmailer.c
index da001dc..3b916e2 100644
--- a/mailbox/progmailer.c
+++ b/mailbox/progmailer.c
@@ -40,6 +40,7 @@
 #include <mailutils/body.h>
 #include <mailutils/message.h>
 #include <mailutils/progmailer.h>
+#include <mailutils/mutil.h>
 
 struct _mu_progmailer
 {
@@ -194,7 +195,7 @@ mu_progmailer_send (struct _mu_progmailer *pm, mu_message_t 
msg)
                                       offset, &len)) == 0
         && len != 0)
     {
-      if (strncasecmp (buffer, MU_HEADER_FCC, sizeof (MU_HEADER_FCC) - 1))
+      if (mu_c_strncasecmp (buffer, MU_HEADER_FCC, sizeof (MU_HEADER_FCC) - 1))
        {
          MU_DEBUG1 (pm->debug, MU_DEBUG_PROT, "Header: %s", buffer);
          if (write (pm->fd, buffer, len) == -1)
diff --git a/mailbox/syslog.c b/mailbox/syslog.c
index 953167b..ad80d70 100644
--- a/mailbox/syslog.c
+++ b/mailbox/syslog.c
@@ -22,6 +22,7 @@
 #include <mailutils/diag.h>
 #include <mailutils/kwd.h>
 #include <mailutils/syslog.h>
+#include <mailutils/mutil.h>
 
 #ifndef LOG_AUTHPRIV
 # define LOG_AUTHPRIV
@@ -48,7 +49,7 @@ static mu_kwd_t kw_facility[] = {
 static int
 syslog_to_n (mu_kwd_t *kw, const char *str, int *pint)
 {
-  if (strncasecmp (str, "LOG_", 4) == 0)
+  if (mu_c_strncasecmp (str, "LOG_", 4) == 0)
     str += 4;
   return mu_kwd_xlat_name_ci (kw, str, pint);
 }
diff --git a/mailbox/url.c b/mailbox/url.c
index 5156dea..1196edb 100644
--- a/mailbox/url.c
+++ b/mailbox/url.c
@@ -507,7 +507,7 @@ url_parse0 (mu_url_t u, char *name, size_t *poff)
                  else if (*name == ';')
                    {
                      /* Make sure it's the auth token. */
-                     if (strncasecmp (name + 1, "auth=", 5) == 0)
+                     if (mu_c_strncasecmp (name + 1, "auth=", 5) == 0)
                        {
                          *name++ = 0;
                          name += 5;
@@ -676,7 +676,7 @@ ACCESSOR(is_same,field) (mu_url_t url1, mu_url_t url2)      
                  \
                                                                          \
   if (status1 && status1 == status2) /* Both fields are missing */       \
     return 1;                                                            \
-  return strcasecmp (s1, s2) == 0;                                       \
+  return mu_c_strcasecmp (s1, s2) == 0;                                        
  \
 }
 
 #define DECL_ACCESSORS(field)                                            \
@@ -820,7 +820,8 @@ mu_url_set_scheme (mu_url_t url, const char *scheme)
 int
 mu_url_is_scheme (mu_url_t url, const char *scheme)
 {
-  if (url && scheme && url->scheme && strcasecmp (url->scheme, scheme) == 0)
+  if (url && scheme && url->scheme 
+      && mu_c_strcasecmp (url->scheme, scheme) == 0)
     return 1;
 
   return 0;
@@ -902,12 +903,12 @@ mu_url_is_ticket (mu_url_t ticket, mu_url_t url)
      equivalent must be defined and match. */
   if (defined (ticket->scheme))
     {
-      if (!url->scheme || strcasecmp (ticket->scheme, url->scheme) != 0)
+      if (!url->scheme || mu_c_strcasecmp (ticket->scheme, url->scheme) != 0)
        return 0;
     }
   if (defined (ticket->host))
     {
-      if (!url->host || strcasecmp (ticket->host, url->host) != 0)
+      if (!url->host || mu_c_strcasecmp (ticket->host, url->host) != 0)
        return 0;
     }
   if (ticket->port && ticket->port != url->port)
diff --git a/mailbox/version.c b/mailbox/version.c
index 2f04832..4d13dad 100644
--- a/mailbox/version.c
+++ b/mailbox/version.c
@@ -22,6 +22,7 @@
 
 #include <mailutils/nls.h>
 #include <mailutils/version.h>
+#include <mailutils/mutil.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -171,10 +172,10 @@ mu_check_option (char *name)
       else
        len = strlen (mu_conf_option[i].name);
 
-      if (strncasecmp (mu_conf_option[i].name, name, len) == 0)
+      if (mu_c_strncasecmp (mu_conf_option[i].name, name, len) == 0)
        return &mu_conf_option[i];
       else if ((q = strchr (mu_conf_option[i].name, '_')) != NULL
-              && strncasecmp (q + 1, name,
+              && mu_c_strncasecmp (q + 1, name,
                               len - (q - mu_conf_option[i].name) - 1) == 0)
        return &mu_conf_option[i];
     }
diff --git a/mh/mh_fmtgram.y b/mh/mh_fmtgram.y
index a4910ce..07dbbcd 100644
--- a/mh/mh_fmtgram.y
+++ b/mh/mh_fmtgram.y
@@ -136,7 +136,7 @@ escape    : component
 
 component : fmtspec OCURLY STRING CCURLY
             {
-             if (strcasecmp ($3, "body") == 0)
+             if (mu_c_strcasecmp ($3, "body") == 0)
                {
                  mh_code_op (mhop_body);
                }
diff --git a/mh/mh_init.c b/mh/mh_init.c
index 629fb04..000142d 100644
--- a/mh/mh_init.c
+++ b/mh/mh_init.c
@@ -864,7 +864,7 @@ mh_decode_2047 (char *text, char **decoded_text)
 
   if (!charset)
     return 1;
-  if (strcasecmp (charset, "auto") == 0)
+  if (mu_c_strcasecmp (charset, "auto") == 0)
     {
       /* Try to deduce the charset from LC_ALL variable */
 
@@ -939,9 +939,9 @@ mh_expand_aliases (mu_message_t msg,
     {
       if (mu_header_sget_field_name (hdr, i, &buf) == 0)
        {
-         if (strcasecmp (buf, MU_HEADER_TO) == 0
-             || strcasecmp (buf, MU_HEADER_CC) == 0
-             || strcasecmp (buf, MU_HEADER_BCC) == 0)
+         if (mu_c_strcasecmp (buf, MU_HEADER_TO) == 0
+             || mu_c_strcasecmp (buf, MU_HEADER_CC) == 0
+             || mu_c_strcasecmp (buf, MU_HEADER_BCC) == 0)
            {
              char *value;
              mu_address_t addr = NULL;
@@ -951,11 +951,11 @@ mh_expand_aliases (mu_message_t msg,
              
              mh_alias_expand (value, &addr, &incl);
              free (value);
-             if (strcasecmp (buf, MU_HEADER_TO) == 0)
+             if (mu_c_strcasecmp (buf, MU_HEADER_TO) == 0)
                mu_address_union (addr_to, addr);
-             else if (strcasecmp (buf, MU_HEADER_CC) == 0)
+             else if (mu_c_strcasecmp (buf, MU_HEADER_CC) == 0)
                mu_address_union (addr_cc ? addr_cc : addr_to, addr);
-             else if (strcasecmp (buf, MU_HEADER_BCC) == 0)
+             else if (mu_c_strcasecmp (buf, MU_HEADER_BCC) == 0)
                mu_address_union (addr_bcc ? addr_bcc : addr_to, addr);
            }
        }
diff --git a/mh/mh_list.c b/mh/mh_list.c
index eb6d2e4..3ae7768 100644
--- a/mh/mh_list.c
+++ b/mh/mh_list.c
@@ -461,7 +461,7 @@ static void print (struct eval_env *env, char *str, int 
nloff);
 static int
 _comp_name (void *item, void *date)
 {
-  return strcasecmp (item, date) == 0;
+  return mu_c_strcasecmp (item, date) == 0;
 }
 
 int
@@ -477,7 +477,7 @@ want_header (struct eval_env *env, char *name)
 
   for (p = strchrnul (str, ','); *str; p = strchrnul (str, ','))
     {
-      if (strncasecmp (name, str, p - str) == 0)
+      if (mu_c_strncasecmp (name, str, p - str) == 0)
        return 0;
       str = p;
       if (*str)
diff --git a/mh/mh_sequence.c b/mh/mh_sequence.c
index ab78afe..9e61be3 100644
--- a/mh/mh_sequence.c
+++ b/mh/mh_sequence.c
@@ -101,7 +101,7 @@ mh_seq_add (const char *name, mh_msgset_t *mset, int flags)
     }
   *p = 0;
   write_sequence (name, new_value, flags & SEQ_PRIVATE);
-  if (strcasecmp (name, "cur") == 0)
+  if (mu_c_strcasecmp (name, "cur") == 0)
     current_message = strtoul (new_value, NULL, 0);
   free (new_value);
 }
diff --git a/mh/mh_whom.c b/mh/mh_whom.c
index d014691..b91d0ad 100644
--- a/mh/mh_whom.c
+++ b/mh/mh_whom.c
@@ -48,7 +48,7 @@ ismydomain (char *p)
   if (!p)
     return 1;
   mu_get_user_email_domain (&domain);
-  return strcasecmp (domain, p + 1) == 0;
+  return mu_c_strcasecmp (domain, p + 1) == 0;
 }
 
 /* FIXME: incl is not used */
diff --git a/mh/mhn.c b/mh/mhn.c
index c871c42..2d6e723 100644
--- a/mh/mhn.c
+++ b/mh/mhn.c
@@ -941,7 +941,7 @@ _get_env (char **env, char *name)
       int len = strlen (*env);
       if (nlen < len
          && (*env)[len+1] == '='
-         && strncasecmp (*env, name, nlen) == 0)
+         && mu_c_strncasecmp (*env, name, nlen) == 0)
        return *env + len + 1;
     }
   return NULL;
@@ -981,8 +981,8 @@ get_extbody_params (mu_message_t msg, char **content, char 
**descr)
        buf[len-1] = 0;
 
       if (descr
-         && strncasecmp (buf, MU_HEADER_CONTENT_DESCRIPTION ":",
-                         sizeof (MU_HEADER_CONTENT_DESCRIPTION)) == 0)
+         && mu_c_strncasecmp (buf, MU_HEADER_CONTENT_DESCRIPTION ":",
+                              sizeof (MU_HEADER_CONTENT_DESCRIPTION)) == 0)
        {
          for (p = buf + sizeof (MU_HEADER_CONTENT_DESCRIPTION);
               *p && isspace (*p); p++)
@@ -990,8 +990,8 @@ get_extbody_params (mu_message_t msg, char **content, char 
**descr)
          *descr = strdup (p);
        }
       else if (content
-              && strncasecmp (buf, MU_HEADER_CONTENT_TYPE ":",
-                              sizeof (MU_HEADER_CONTENT_TYPE)) == 0)
+              && mu_c_strncasecmp (buf, MU_HEADER_CONTENT_TYPE ":",
+                                   sizeof (MU_HEADER_CONTENT_TYPE)) == 0)
        {
          char *q;
          for (p = buf + sizeof (MU_HEADER_CONTENT_TYPE);
@@ -1027,13 +1027,13 @@ match_content (char *content)
 
   split_content (content, &type, &subtype);
 
-  if ((rc = strcasecmp (content_type, type)) == 0)
+  if ((rc = mu_c_strcasecmp (content_type, type)) == 0)
     {
       if (content_subtype)
-       rc = strcasecmp (content_subtype, subtype);
+       rc = mu_c_strcasecmp (content_subtype, subtype);
     }
   else 
-    rc = strcasecmp (content_type, subtype);
+    rc = mu_c_strcasecmp (content_type, subtype);
 
   free (type);
   free (subtype);
@@ -2349,9 +2349,9 @@ edit_mime (char *cmd, struct compose_env *env, 
mu_message_t *msg, int level)
       
       _get_content_type (hdr, &typestr, NULL);
       split_content (typestr, &type, &subtype);
-      if (strcasecmp (type, "message") == 0)
+      if (mu_c_strcasecmp (type, "message") == 0)
        encoding = strdup ("7bit");
-      else if (strcasecmp (type, "text") == 0)
+      else if (mu_c_strcasecmp (type, "text") == 0)
        encoding = strdup ("quoted-printable");
       else
        encoding = strdup ("base64");
diff --git a/mh/mhparam.c b/mh/mhparam.c
index d4b7fe5..5cbe90d 100644
--- a/mh/mhparam.c
+++ b/mh/mhparam.c
@@ -82,8 +82,8 @@ char *
 mhparam_defval (char *comp)
 {
   int i;
-  for (i = 0; i < sizeof(defvaltab)/sizeof(defvaltab[0]); i++)
-    if (strcasecmp(defvaltab[i].comp, comp) == 0)
+  for (i = 0; i < sizeof (defvaltab) / sizeof (defvaltab[0]); i++)
+    if (mu_c_strcasecmp (defvaltab[i].comp, comp) == 0)
       return defvaltab[i].val;
   return NULL;
 }
diff --git a/mh/pick.y b/mh/pick.y
index 2a4ffa3..fcbe326 100644
--- a/mh/pick.y
+++ b/mh/pick.y
@@ -303,7 +303,7 @@ match_header (mu_message_t msg, char *comp, regex_t *regex)
   for (i = 1; i <= count; i++)
     {
       mu_header_get_field_name (hdr, i, buf, sizeof buf, NULL);
-      if (strcasecmp (buf, comp) == 0)
+      if (mu_c_strcasecmp (buf, comp) == 0)
        {
          mu_header_get_field_value (hdr, i, buf, sizeof buf, NULL);
          if (regexec (regex, buf, 0, NULL, 0) == 0)
diff --git a/mh/sortm.c b/mh/sortm.c
index 231cdc0..b13e256 100644
--- a/mh/sortm.c
+++ b/mh/sortm.c
@@ -276,11 +276,11 @@ compare_action (void *item, void *data)

   ap = a;
   bp = b;
-  if (strcasecmp (op->field, MU_HEADER_SUBJECT) == 0)
+  if (mu_c_strcasecmp (op->field, MU_HEADER_SUBJECT) == 0)
     {
-      if (strncasecmp (ap, "re:", 3) == 0)
+      if (mu_c_strncasecmp (ap, "re:", 3) == 0)
        ap += 3;
-      if (strncasecmp (b, "re:", 3) == 0)
+      if (mu_c_strncasecmp (b, "re:", 3) == 0)
        bp += 3;
     }
   
@@ -316,7 +316,7 @@ compare_messages (mu_message_t a, mu_message_t b, size_t 
anum, size_t bnum)
 static int
 comp_text (void *a, void *b)
 {
-  return strcasecmp (a, b);
+  return mu_c_strcasecmp (a, b);
 }
 
 static int
diff --git a/pop3d/pop3d.c b/pop3d/pop3d.c
index 52e6639..6a9a981 100644
--- a/pop3d/pop3d.c
+++ b/pop3d/pop3d.c
@@ -361,34 +361,34 @@ pop3d_mainloop (int fd, FILE *infile, FILE *outfile)
        status = ERR_TOO_LONG;
       else if (strlen (cmd) > 4)
        status = ERR_BAD_CMD;
-      else if (strncasecmp (cmd, "RETR", 4) == 0)
+      else if (mu_c_strncasecmp (cmd, "RETR", 4) == 0)
        status = pop3d_retr (arg);
-      else if (strncasecmp (cmd, "DELE", 4) == 0)
+      else if (mu_c_strncasecmp (cmd, "DELE", 4) == 0)
        status = pop3d_dele (arg);
-      else if (strncasecmp (cmd, "USER", 4) == 0)
+      else if (mu_c_strncasecmp (cmd, "USER", 4) == 0)
        status = pop3d_user (arg);
-      else if (strncasecmp (cmd, "QUIT", 4) == 0)
+      else if (mu_c_strncasecmp (cmd, "QUIT", 4) == 0)
        status = pop3d_quit (arg);
-      else if (strncasecmp (cmd, "APOP", 4) == 0)
+      else if (mu_c_strncasecmp (cmd, "APOP", 4) == 0)
        status = pop3d_apop (arg);
-      else if (strncasecmp (cmd, "AUTH", 4) == 0)
+      else if (mu_c_strncasecmp (cmd, "AUTH", 4) == 0)
        status = pop3d_auth (arg);
-      else if (strncasecmp (cmd, "STAT", 4) == 0)
+      else if (mu_c_strncasecmp (cmd, "STAT", 4) == 0)
        status = pop3d_stat (arg);
-      else if (strncasecmp (cmd, "LIST", 4) == 0)
+      else if (mu_c_strncasecmp (cmd, "LIST", 4) == 0)
        status = pop3d_list (arg);
-      else if (strncasecmp (cmd, "NOOP", 4) == 0)
+      else if (mu_c_strncasecmp (cmd, "NOOP", 4) == 0)
        status = pop3d_noop (arg);
-      else if (strncasecmp (cmd, "RSET", 4) == 0)
+      else if (mu_c_strncasecmp (cmd, "RSET", 4) == 0)
        status = pop3d_rset (arg);
-      else if ((strncasecmp (cmd, "TOP", 3) == 0) && (strlen (cmd) == 3))
+      else if ((mu_c_strncasecmp (cmd, "TOP", 3) == 0) && (strlen (cmd) == 3))
        status = pop3d_top (arg);
-      else if (strncasecmp (cmd, "UIDL", 4) == 0)
+      else if (mu_c_strncasecmp (cmd, "UIDL", 4) == 0)
        status = pop3d_uidl (arg);
-      else if (strncasecmp (cmd, "CAPA", 4) == 0)
+      else if (mu_c_strncasecmp (cmd, "CAPA", 4) == 0)
        status = pop3d_capa (arg);
 #ifdef WITH_TLS
-      else if ((strncasecmp (cmd, "STLS", 4) == 0) && tls_available)
+      else if ((mu_c_strncasecmp (cmd, "STLS", 4) == 0) && tls_available)
        {
          status = pop3d_stls (arg);
          if (status)
diff --git a/pop3d/user.c b/pop3d/user.c
index 91a4f44..0616bd7 100644
--- a/pop3d/user.c
+++ b/pop3d/user.c
@@ -120,7 +120,7 @@ pop3d_user (const char *arg)
       free (tmp);
     }
 
-  if (strcasecmp (cmd, "PASS") == 0)
+  if (mu_c_strcasecmp (cmd, "PASS") == 0)
     {
       int rc;
 
@@ -155,7 +155,7 @@ pop3d_user (const char *arg)
          return ERR_BAD_LOGIN;
        }
     }
-  else if (strcasecmp (cmd, "QUIT") == 0)
+  else if (mu_c_strcasecmp (cmd, "QUIT") == 0)
     {
       mu_diag_output (MU_DIAG_INFO, _("Possible probe of account `%s'"), arg);
       free (cmd);
diff --git a/readmsg/readmsg.c b/readmsg/readmsg.c
index 470ba3c..f1fd16d 100644
--- a/readmsg/readmsg.c
+++ b/readmsg/readmsg.c
@@ -355,7 +355,7 @@ main (int argc, char **argv)
 
   for (i = 0; i < weedc; i++)
     {
-      if (strcasecmp (weedv[i], "From_") == 0)
+      if (mu_c_strcasecmp (weedv[i], "From_") == 0)
        {
          int j;
          unix_header = 1;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]