Added a bit of iconv code to rfc2ftn
This commit is contained in:
parent
230bbd87c3
commit
b19fb0af99
@ -97,6 +97,10 @@
|
||||
#endif
|
||||
#include <locale.h>
|
||||
#include <langinfo.h>
|
||||
#ifdef HAVE_ICONV_H
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* used to use #elif, but native braindead hpux 9.00 c compiler didn't
|
||||
* * understand it */
|
||||
|
@ -78,6 +78,10 @@ extern int most_debug;
|
||||
* Internal functions
|
||||
*/
|
||||
int needputrfc(rfcmsg *, int);
|
||||
#ifdef USE_EXPERIMENT
|
||||
int use_iconv = FALSE;
|
||||
iconv_t iconv_s;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -350,6 +354,19 @@ int rfc2ftn(FILE *fp, faddr *recipient)
|
||||
*/
|
||||
charset_set_in_out(charset,getrfcchrs(msgs.Charset));
|
||||
#endif
|
||||
#ifdef USE_EXPERIMENT
|
||||
if (strcmp(charset,getrfcchrs(msgs.Charset)) == 0) {
|
||||
Syslog('m', "rfc2ftn: no need for iconv");
|
||||
} else {
|
||||
iconv_s = iconv_open(getrfcchrs(msgs.Charset), charset);
|
||||
if (iconv_s != (iconv_t)-1) {
|
||||
Syslog('m', "rfc2ftn: activated iconv");
|
||||
use_iconv = TRUE;
|
||||
} else {
|
||||
Syslog('+', "rfc2ftn: iconv_open(%s, %s) failed", getrfcchrs(msgs.Charset), charset);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
do {
|
||||
Syslog('m', "rfc2ftn: split loop, splitpart = %d", splitpart);
|
||||
@ -751,6 +768,16 @@ int rfc2ftn(FILE *fp, faddr *recipient)
|
||||
|
||||
Syslog('m', "rfc2ftn: out of splitloop");
|
||||
|
||||
#ifdef USE_EXPERIMENT
|
||||
if (use_iconv) {
|
||||
if (iconv_close(iconv_s))
|
||||
WriteError("$rfc2ftn: iconv_close()");
|
||||
else
|
||||
Syslog('m', "rfc2ftn: inconv_close() success");
|
||||
use_iconv = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
free(temp);
|
||||
if (charset)
|
||||
free(charset);
|
||||
|
Reference in New Issue
Block a user