summaryrefslogtreecommitdiff
path: root/frm
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-08-13 15:12:50 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-08-13 15:12:50 +0300
commit73fe9290251b13e7e5d978a6bfbe014499f87e36 (patch)
tree8cdb55deefc1c8ab1ac3ffcd86f67be57d3b58ad /frm
parenteee2dde23b558aecd59b690ff9007341869577cb (diff)
downloadmailutils-73fe9290251b13e7e5d978a6bfbe014499f87e36.tar.gz
mailutils-73fe9290251b13e7e5d978a6bfbe014499f87e36.tar.bz2
Fix building with fribidi2
* configure.ac: Check for wcwidth and wchar.h. * frm/common.c (get_charset): Aways allocate output_charset. Provide a substitution for fribidi_wcwidth if it is not available. (puts_bidi): Use mu_fribidi_wcwidth.
Diffstat (limited to 'frm')
-rw-r--r--frm/common.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/frm/common.c b/frm/common.c
index 77f06850a..4cd4f7152 100644
--- a/frm/common.c
+++ b/frm/common.c
@@ -62,10 +62,10 @@ static char *output_charset = NULL;
const char *
get_charset ()
{
- char *tmp;
-
if (!output_charset)
{
+ char *tmp;
+ const char *str = NULL;
char locale[32];
memset (locale, 0, sizeof (locale));
@@ -86,16 +86,16 @@ get_charset ()
lang = strtok_r (locale, "_", &sp);
terr = strtok_r (NULL, ".", &sp);
- output_charset = strtok_r (NULL, "@", &sp);
+ str = strtok_r (NULL, "@", &sp);
- if (output_charset)
- output_charset = xstrdup (output_charset);
- else
- output_charset = mu_charset_lookup (lang, terr);
+ if (!str)
+ str = mu_charset_lookup (lang, terr);
}
- if (!output_charset)
- output_charset = "ASCII";
+ if (!str)
+ str = "ASCII";
+
+ output_charset = xstrdup (str);
}
return output_charset;
}
@@ -104,6 +104,20 @@ get_charset ()
/* BIDI support (will be moved to lib when it's ready) */
#ifdef HAVE_LIBFRIBIDI
+# ifdef HAVE_FRIBIDI_WCWIDTH
+# define mu_fribidi_wcwidth fribidi_wcwidth
+# else
+# if defined(HAVE_WCHAR_H) && defined(HAVE_WCWIDTH)
+# include <wchar.h>
+# define mu_fribidi_wcwidth(c) wcwidth((wchar_t)c)
+# else
+# undef HAVE_LIBFRIBIDI
+# endif
+# endif
+#endif
+
+#ifdef HAVE_LIBFRIBIDI
+
static int fb_charset_num = -1;
FriBidiChar *logical;
char *outstring;
@@ -170,7 +184,7 @@ puts_bidi (char *string)
if (fb_charset_num != FRIBIDI_CHARSET_CAP_RTL)
{
while (wid > 0 && idx < len)
- wid -= fribidi_wcwidth (visual[idx++]);
+ wid -= mu_fribidi_wcwidth (visual[idx++]);
}
else
{

Return to:

Send suggestions and report system problems to the System administrator.