/[LeafOK_CVS]/lbbs/src/io.c
ViewVC logotype

Diff of /lbbs/src/io.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.59 by sysadm, Sun Oct 19 13:13:07 2025 UTC Revision 1.60 by sysadm, Mon Oct 20 01:55:50 2025 UTC
# Line 170  int iflush(void) Line 170  int iflush(void)
170                                          if (ret < 0)                                          if (ret < 0)
171                                          {                                          {
172                                                  log_error("io_buf_conv(stdout, %d, %d, %d) error\n", stdout_buf_len, stdout_buf_offset, stdout_conv_len);                                                  log_error("io_buf_conv(stdout, %d, %d, %d) error\n", stdout_buf_len, stdout_buf_offset, stdout_conv_len);
173                                                    stdout_buf_len = stdout_buf_offset; // Discard invalid sequence
174                                          }                                          }
175                                  }                                  }
176    
# Line 399  int igetch(int timeout) Line 400  int igetch(int timeout)
400                          if (ret < 0)                          if (ret < 0)
401                          {                          {
402                                  log_error("io_buf_conv(stdin, %d, %d, %d) error\n", stdin_buf_len, stdin_buf_offset, stdin_conv_len);                                  log_error("io_buf_conv(stdin, %d, %d, %d) error\n", stdin_buf_len, stdin_buf_offset, stdin_conv_len);
403                                    stdin_buf_len = stdin_buf_offset; // Discard invalid sequence
404                          }                          }
405    
406                          // For debug                          // For debug
# Line 936  int io_buf_conv(iconv_t cd, char *p_buf, Line 938  int io_buf_conv(iconv_t cd, char *p_buf,
938                  {                  {
939                          if (out_bytes <= 0)                          if (out_bytes <= 0)
940                          {                          {
941                                  log_error("iconv(inbytes=%d, outbytes=%d) error: EILSEQ and E2BIG\n", in_bytes, out_bytes);                                  log_error("No enough free space in p_conv, conv_len=%d, conv_size=%d\n", *p_conv_len, conv_size);
942                                  return -2;                                  return -2;
943                          }                          }
944    
# Line 1031  int io_conv_init(const char *charset) Line 1033  int io_conv_init(const char *charset)
1033          strncpy(stdio_charset, charset, sizeof(stdio_charset) - 1);          strncpy(stdio_charset, charset, sizeof(stdio_charset) - 1);
1034          stdio_charset[sizeof(stdio_charset) - 1] = '\0';          stdio_charset[sizeof(stdio_charset) - 1] = '\0';
1035    
1036          stdin_cd = iconv_open(BBS_DEFAULT_CHARSET "//IGNORE", stdio_charset);          snprintf(tocode, sizeof(tocode), "%s%s", BBS_DEFAULT_CHARSET,
1037                             (strcasecmp(stdio_charset, BBS_DEFAULT_CHARSET) == 0 ? "" : "//IGNORE"));
1038            stdin_cd = iconv_open(tocode, stdio_charset);
1039          if (stdin_cd == (iconv_t)(-1))          if (stdin_cd == (iconv_t)(-1))
1040          {          {
1041                  log_error("iconv_open(%s->%s) error: %d\n", stdio_charset, BBS_DEFAULT_CHARSET "//IGNORE", errno);                  log_error("iconv_open(%s->%s) error: %d\n", stdio_charset, tocode, errno);
1042                  return -2;                  return -2;
1043          }          }
1044    
1045          snprintf(tocode, sizeof(tocode), "%s//TRANSLIT", stdio_charset);          snprintf(tocode, sizeof(tocode), "%s%s", stdio_charset,
1046                             (strcasecmp(BBS_DEFAULT_CHARSET, stdio_charset) == 0 ? "" : "//TRANSLIT"));
1047          stdout_cd = iconv_open(tocode, BBS_DEFAULT_CHARSET);          stdout_cd = iconv_open(tocode, BBS_DEFAULT_CHARSET);
1048          if (stdout_cd == (iconv_t)(-1))          if (stdout_cd == (iconv_t)(-1))
1049          {          {


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1