<<< Date Index >>>     <<< Thread Index >>>

[PATCH] Interix support in regexp.c



To compile mutt-1.5.18 on Interix (scaringly close to Windows) I had to
make a little patch.  Please review carefully, as I'm unsure about the
int whereas what's actually required is a char, but then via this
bitshift...  I've tested this patch on Darwin, Solaris and Interix,
where regular expressions still seem to work fine with this patch.


-- 
Fabian Groffen
Gentoo on a different level
* Interix doesn't have btowc, but it does have mbtowc.  Linux manpage
  also discourages the use of btowc.

--- regex.c
+++ regex.c
@@ -2212,6 +2212,7 @@
                         boolean is_lower = STREQ (str, "lower");
                         boolean is_upper = STREQ (str, "upper");
                        wctype_t wt;
+                       wchar_t twt;
                         int ch;
 
                        wt = wctype (str);
@@ -2226,7 +2227,7 @@
 
                         for (ch = 0; ch < 1 << BYTEWIDTH; ++ch)
                          {
-                           if (iswctype (btowc (ch), wt))
+                           if (mbtowc (&twt, (char *)&ch, 1) >= 0 && iswctype 
(twt, wt))
                              SET_LIST_BIT (ch);
 
                            if (translate && (is_upper || is_lower)