f5ffc346ee0509a190d19a5cefb2856295d98980
2 * Simple iconv library stub so that programs have something to link against
10 int _libiconv_version
= _LIBICONV_VERSION
;
12 iconv_t
iconv_open (const char *tocode
, const char *fromcode
)
14 /* ASCII -> UTF8 and ASCII -> ISO-8859-x mappings can be
15 * faked without doing any actual conversion, mapping
16 * between identical charsets is a no-op, so claim to
18 if (!strncasecmp(fromcode
, tocode
, strlen(fromcode
)) ||
19 (!strncasecmp(tocode
, "UTF-8", strlen("UTF-8")) &&
20 !strncasecmp(fromcode
, "ASCII", strlen("ASCII"))) ||
21 (!strncasecmp(tocode
, "ISO-8859-", strlen("ISO-8859-")) &&
22 !strncasecmp(fromcode
, "ASCII", strlen("ASCII"))))
32 size_t iconv (iconv_t cd
, char **inbuf
, size_t *inbytesleft
,
33 char **outbuf
, size_t *outbytesleft
)
37 if (cd
== (iconv_t
)(1))
39 if ((*inbytesleft
< 0) || (*outbytesleft
< 0) ||
40 (outbuf
== NULL
) || (*outbuf
== NULL
))
46 if ((inbuf
!= NULL
) && (*inbuf
!= NULL
))
48 len
= (*inbytesleft
> *outbytesleft
)
49 ? *outbytesleft
: *inbytesleft
;
51 memcpy(*outbuf
, *inbuf
, len
);
74 int iconv_close (iconv_t cd
)