[PATCH] outgoing charset detection for non-GNU iconv
Piotr Meyer <[email protected]>
| Newsgroups | gmane.network.slrn.user |
|---|---|
| Message-ID | <[email protected]> |
Created and tested on NetBSD. Local implementation of iconv() has different behaviours than expected by SLRN in src/charset.c. More details about iconv's differences: http://mail-index.netbsd.org/tech-userlevel/2006/04/02/0000.html and http://mail-index.netbsd.org/tech-userlevel/2006/04/ (thread "behaviour of iconv in NetBSD and pkgsrc libiconv" Patch in attachement and under following URL: http://aniou.smutek.pl/slrn-non-gnu-iconv.diff -- Piotr 'aniou' Meyer ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword
slrn-non-gnu-iconv.diff
(text/plain, 1.7 KB)
Index: src/charset.c
===================================================================
--- src/charset.c (revision 310)
+++ src/charset.c (working copy)
@@ -140,8 +140,14 @@
errno = 0;
ret = iconv (cd, &str, &inbytesleft, &bufp, &outbytesleft);
+
+#if NON_GNU_ICONV
+ if (ret == 0)
+ break;
+#else
if (ret != (size_t) -1)
break;
+#endif
switch (errno)
{
@@ -159,8 +165,9 @@
outbytesleft--;
/* FIXME: Should the shift-state be reset? */
break;
-
+#if !NON_GNU_ICONV
case 0: /* windows bug */
+#endif
case E2BIG:
need_realloc = 1;
break;
Index: src/slrnfeat.hin
===================================================================
--- src/slrnfeat.hin (revision 310)
+++ src/slrnfeat.hin (working copy)
@@ -254,6 +254,12 @@
# define N_(a) a
#endif
+/* for non-GNU versions of iconv (at least for NetBSD):
+ * http://mail-index.netbsd.org/tech-userlevel/2006/04/02/0000.html
+ * and http://netbsd.gw.com/cgi-bin/man-cgi?iconv+3
+ */
+#define NON_GNU_ICONV @NON_GNU_ICONV@
+
/* Default startup mode, selected automatically. Do not modify.
*/
#if SLRN_HAS_NNTP_SUPPORT
Index: autoconf/configure.ac
===================================================================
--- autoconf/configure.ac (revision 310)
+++ autoconf/configure.ac (working copy)
@@ -173,7 +173,11 @@
CF_COMPILE_OPTION(grouplens,
[ --enable-grouplens Enable GroupLens support],
[SLRN_HAS_GROUPLENS], 0)
+CF_COMPILE_OPTION(non-gnu-iconv,
+ [ --enable-non-gnu-iconv Local iconv isn't GNU-compatible one],
+ [NON_GNU_ICONV], 0)
+
jd_with_uu_library=no
JD_CHECK_FOR_LIBRARY(uu,uudeview.h)
if test $jd_with_uu_library = yes