| 64 |
static int stdin_conv_offset = 0; |
static int stdin_conv_offset = 0; |
| 65 |
static int stdout_conv_offset = 0; |
static int stdout_conv_offset = 0; |
| 66 |
|
|
| 67 |
static iconv_t stdin_cd = NULL; |
static iconv_t stdin_cd = (iconv_t)(-1); |
| 68 |
static iconv_t stdout_cd = NULL; |
static iconv_t stdout_cd = (iconv_t)(-1); |
| 69 |
|
|
| 70 |
int io_init(void) |
int io_init(void) |
| 71 |
{ |
{ |
| 1189 |
{ |
{ |
| 1190 |
log_error("iconv_open(%s->%s) error: %d\n", BBS_default_charset, tocode, errno); |
log_error("iconv_open(%s->%s) error: %d\n", BBS_default_charset, tocode, errno); |
| 1191 |
iconv_close(stdin_cd); |
iconv_close(stdin_cd); |
| 1192 |
|
stdin_cd = (iconv_t)(-1); |
| 1193 |
return -2; |
return -2; |
| 1194 |
} |
} |
| 1195 |
|
|
| 1198 |
|
|
| 1199 |
int io_conv_cleanup(void) |
int io_conv_cleanup(void) |
| 1200 |
{ |
{ |
| 1201 |
if (stdin_cd != NULL) |
if (stdin_cd != (iconv_t)(-1)) |
| 1202 |
{ |
{ |
| 1203 |
iconv_close(stdin_cd); |
iconv_close(stdin_cd); |
| 1204 |
stdin_cd = NULL; |
stdin_cd = (iconv_t)(-1); |
| 1205 |
} |
} |
| 1206 |
if (stdout_cd != NULL) |
if (stdout_cd != (iconv_t)(-1)) |
| 1207 |
{ |
{ |
| 1208 |
iconv_close(stdout_cd); |
iconv_close(stdout_cd); |
| 1209 |
stdout_cd = NULL; |
stdout_cd = (iconv_t)(-1); |
| 1210 |
} |
} |
| 1211 |
|
|
| 1212 |
return 0; |
return 0; |