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

Diff of /lbbs/src/bbs_net.c

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

Revision 1.66 by sysadm, Sat Oct 18 01:50:48 2025 UTC Revision 1.70 by sysadm, Sun Oct 19 14:34:37 2025 UTC
# Line 47  Line 47 
47  #define MAXSTATION 26 * 2  #define MAXSTATION 26 * 2
48  #define STATION_PER_LINE 4  #define STATION_PER_LINE 4
49    
 #define BBS_NET_DEFAULT_CHARSET "UTF-8"  
   
50  struct _bbsnet_conf  struct _bbsnet_conf
51  {  {
52          char host1[20];          char host1[20];
# Line 209  int bbsnet_connect(int n) Line 207  int bbsnet_connect(int n)
207          int output_buf_len = 0;          int output_buf_len = 0;
208          int input_buf_offset = 0;          int input_buf_offset = 0;
209          int output_buf_offset = 0;          int output_buf_offset = 0;
         iconv_t input_cd = NULL;  
210          char input_conv[LINE_BUFFER_LEN * 2];          char input_conv[LINE_BUFFER_LEN * 2];
211          char output_conv[LINE_BUFFER_LEN * 2];          char output_conv[LINE_BUFFER_LEN * 2];
212          int input_conv_len = 0;          int input_conv_len = 0;
213          int output_conv_len = 0;          int output_conv_len = 0;
214          int input_conv_offset = 0;          int input_conv_offset = 0;
215          int output_conv_offset = 0;          int output_conv_offset = 0;
216            iconv_t input_cd = NULL;
217          iconv_t output_cd = NULL;          iconv_t output_cd = NULL;
218            char tocode[32];
219          struct epoll_event ev, events[MAX_EVENTS];          struct epoll_event ev, events[MAX_EVENTS];
220          int nfds, epollfd;          int nfds, epollfd;
221          int stdin_read_wait = 0;          int stdin_read_wait = 0;
# Line 425  int bbsnet_connect(int n) Line 424  int bbsnet_connect(int n)
424          log_common("BBSNET connect to %s:%d from %s:%d by [%s]\n",          log_common("BBSNET connect to %s:%d from %s:%d by [%s]\n",
425                             remote_addr, remote_port, local_addr, local_port, BBS_username);                             remote_addr, remote_port, local_addr, local_port, BBS_username);
426    
427          input_cd = iconv_open(bbsnet_conf[n].charset, BBS_NET_DEFAULT_CHARSET);          snprintf(tocode, sizeof(tocode), "%s//IGNORE", bbsnet_conf[n].charset);
428            input_cd = iconv_open(tocode, stdio_charset);
429          if (input_cd == (iconv_t)(-1))          if (input_cd == (iconv_t)(-1))
430          {          {
431                  log_error("iconv_open(%s->%s) error: %d\n", BBS_NET_DEFAULT_CHARSET, bbsnet_conf[n].charset, errno);                  log_error("iconv_open(%s->%s) error: %d\n", stdio_charset, tocode, errno);
432                  goto cleanup;                  goto cleanup;
433          }          }
434          output_cd = iconv_open(BBS_NET_DEFAULT_CHARSET, bbsnet_conf[n].charset);  
435          if (input_cd == (iconv_t)(-1))          snprintf(tocode, sizeof(tocode), "%s//TRANSLIT", stdio_charset);
436            output_cd = iconv_open(tocode, bbsnet_conf[n].charset);
437            if (output_cd == (iconv_t)(-1))
438          {          {
439                  log_error("iconv_open(%s->%s) error: %d\n", bbsnet_conf[n].charset, BBS_NET_DEFAULT_CHARSET, errno);                  log_error("iconv_open(%s->%s) error: %d\n", bbsnet_conf[n].charset, tocode, errno);
440                  iconv_close(input_cd);                  iconv_close(input_cd);
441                  goto cleanup;                  goto cleanup;
442          }          }


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

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