--- lbbs/src/bbs_net.c 2025/10/20 01:55:50 1.71 +++ lbbs/src/bbs_net.c 2025/11/01 15:34:45 1.75 @@ -56,9 +56,9 @@ struct _bbsnet_conf char charset[20]; } bbsnet_conf[MAXSTATION]; -MENU_SET bbsnet_menu; +static MENU_SET bbsnet_menu; -int load_bbsnet_conf(const char *file_config) +static int load_bbsnet_conf(const char *file_config) { FILE *fp; MENU *p_menu; @@ -153,7 +153,7 @@ int load_bbsnet_conf(const char *file_co return 0; } -void unload_bbsnet_conf(void) +static void unload_bbsnet_conf(void) { bbsnet_menu.menu_count = 0; bbsnet_menu.menu_item_count = 0; @@ -164,7 +164,7 @@ void unload_bbsnet_conf(void) bbsnet_menu.p_menu_item_pool = NULL; } -void process_bar(int n, int len) +static void process_bar(int n, int len) { char buf[LINE_BUFFER_LEN]; char buf2[LINE_BUFFER_LEN]; @@ -185,14 +185,14 @@ void process_bar(int n, int len) moveto(4, 0); prints(" ------------------------------ \r\n"); snprintf(buf, sizeof(buf), " %3d%% ", n * 100 / len); - strncpy(buf2, buf, (size_t)n); + memcpy(buf2, buf, (size_t)n); buf2[n] = '\0'; prints("|\033[46m%s\033[44m%s\033[m|\r\n", buf2, buf + n); prints(" ------------------------------ \r\n"); iflush(); } -int bbsnet_connect(int n) +static int bbsnet_connect(int n) { int sock, ret, loop, error; int sock_connected = 0; @@ -536,6 +536,11 @@ int bbsnet_connect(int n) } else if (ret == 0) { + // Send NO-OP to remote server + input_buf[input_buf_len] = '\0'; + input_buf_len++; + BBS_last_access_tm = time(NULL); + stdin_read_wait = 0; break; // Check whether channel is still open } @@ -591,12 +596,28 @@ int bbsnet_connect(int n) { if (input_buf_offset < input_buf_len) { + // For debug +#ifdef _DEBUG + for (int j = input_buf_offset; j < input_buf_len; j++) + { + log_error("Debug input: <--[%u]\n", (input_buf[j] + 256) % 256); + } +#endif + ret = io_buf_conv(input_cd, input_buf, &input_buf_len, &input_buf_offset, input_conv, sizeof(input_conv), &input_conv_len); if (ret < 0) { log_error("io_buf_conv(input, %d, %d, %d) error\n", input_buf_len, input_buf_offset, input_conv_len); input_buf_len = input_buf_offset; // Discard invalid sequence } + + // For debug +#ifdef _DEBUG + for (int j = input_conv_offset; j < input_conv_len; j++) + { + log_error("Debug input_conv: <--[%u]\n", (input_conv[j] + 256) % 256); + } +#endif } while (input_conv_offset < input_conv_len && !SYS_server_exit) @@ -781,11 +802,12 @@ cleanup: tm_used->tm_mday - 1, tm_used->tm_hour, tm_used->tm_min, tm_used->tm_sec); + BBS_last_access_tm = time(NULL); + return 0; } -static int -bbsnet_refresh() +static int bbsnet_refresh() { clearscr(); moveto(1, 0); @@ -809,7 +831,7 @@ bbsnet_refresh() return 0; } -int bbsnet_selchange() +static int bbsnet_selchange() { int i = bbsnet_menu.menu_item_pos[0]; @@ -834,7 +856,7 @@ int bbsnet_selchange() return 0; } -int bbs_net() +extern int bbs_net() { int ch, i;