--- lbbs/src/bbs_net.c 2005/03/21 17:10:51 1.2 +++ lbbs/src/bbs_net.c 2025/05/02 03:34:58 1.16 @@ -1,9 +1,9 @@ /*************************************************************************** - bbs_net.c - description - ------------------- - begin : Mon Oct 18 2004 - copyright : (C) 2004 by Leaflet - email : leaflet@leafok.com + bbs_net.c - description + ------------------- + begin : Mon Oct 18 2004 + copyright : (C) 2004 by Leaflet + email : leaflet@leafok.com ***************************************************************************/ /*************************************************************************** @@ -17,7 +17,9 @@ #include "bbs.h" #include "common.h" +#include "log.h" #include "io.h" +#include "screen.h" #include "menu.h" #include "tcplib.h" #include @@ -30,497 +32,396 @@ #include #include -#define TIME_OUT 15 +#define TIME_OUT 15 #define MAX_PROCESS_BAR_LEN 30 -#define MAXSTATION 26*2 +#define MAXSTATION 26 * 2 +#define STATION_PER_LINE 4 struct _bbsnet_conf { - char host1[20]; - char host2[40]; - char ip[40]; - int port; + char host1[20]; + char host2[40]; + char ip[40]; + int port; } bbsnet_conf[MAXSTATION]; MENU_SET bbsnet_menu; -int -load_bbsnet_conf (const char *file_config) +int load_bbsnet_conf(const char *file_config) { - FILE *fp; - MENU *p_menu; - MENU_ITEM *p_menuitem; - char t[256], *t1, *t2, *t3, *t4; - int item_count = 0; - - fp = fopen (file_config, "r"); - if (fp == NULL) - return -1; - - p_menu = bbsnet_menu.p_menu[0] = malloc (sizeof (MENU)); - strcpy (p_menu->name, "BBSNET"); - p_menu->title.show = 0; - p_menu->screen.show = 0; - - while (fgets (t, 255, fp) && item_count < MAXSTATION) - { - t1 = strtok (t, " \t"); - t2 = strtok (NULL, " \t\n"); - t3 = strtok (NULL, " \t\n"); - t4 = strtok (NULL, " \t\n"); - - if (t1[0] == '#' || t1[0] == '*' || t1 == NULL || t2 == NULL - || t3 == NULL) - continue; - strncpy (bbsnet_conf[item_count].host1, t2, 18); - bbsnet_conf[item_count].host1[18] = 0; - strncpy (bbsnet_conf[item_count].host2, t1, 36); - bbsnet_conf[item_count].host2[36] = 0; - strncpy (bbsnet_conf[item_count].ip, t3, 36); - bbsnet_conf[item_count].ip[36] = 0; - bbsnet_conf[item_count].port = t4 ? atoi (t4) : 23; - - p_menuitem = p_menu->items[item_count] = malloc (sizeof (MENU_ITEM)); - p_menuitem->row = 2 + item_count / 3; - p_menuitem->col = 5 + item_count % 3 * 20; - sprintf (p_menuitem->action, "%d", item_count); - p_menuitem->submenu = 0; - p_menuitem->priv = 0; - p_menuitem->level = 0; - p_menuitem->display = 0; - p_menuitem->name[0] = - (item_count < MAXSTATION / 2 ? 'A' + item_count : 'a' + item_count); - p_menuitem->name[1] = '\0'; - sprintf (p_menuitem->text, "1;36m%c. %s", - p_menuitem->name[0], bbsnet_conf[item_count].host2); - - item_count++; - } - fclose (fp); - - p_menu->item_count = item_count; - p_menu->item_cur_pos = 0; - - bbsnet_menu.menu_count = 1; - bbsnet_menu.menu_select_depth = 0; - bbsnet_menu.p_menu_select[0] = bbsnet_menu.p_menu[0]; + FILE *fp; + MENU *p_menu; + MENU_ITEM *p_menuitem; + char t[256], *t1, *t2, *t3, *t4; + int item_count = 0; + + fp = fopen(file_config, "r"); + if (fp == NULL) + return -1; + + p_menu = bbsnet_menu.p_menu[0] = malloc(sizeof(MENU)); + strcpy(p_menu->name, "BBSNET"); + p_menu->title.show = 0; + p_menu->screen.show = 0; - return 0; -} - -// from Maple-hightman -// added by flyriver, 2001.3.3 -int -telnetopt (int fd, char *buf, int max) -{ - unsigned char c, d, e; - int pp = 0; - unsigned char tmp[30]; - - while (pp < max) - { - c = buf[pp++]; - if (c == 255) + while (fgets(t, 255, fp) && item_count < MAXSTATION) { - d = buf[pp++]; - e = buf[pp++]; - iflush (); - if ((d == 253) && (e == 3 || e == 24)) - { - tmp[0] = 255; - tmp[1] = 251; - tmp[2] = e; - write (fd, tmp, 3); - continue; - } - if ((d == 251 || d == 252) && (e == 1 || e == 3 || e == 24)) - { - tmp[0] = 255; - tmp[1] = 253; - tmp[2] = e; - write (fd, tmp, 3); - continue; - } - if (d == 251 || d == 252) - { - tmp[0] = 255; - tmp[1] = 254; - tmp[2] = e; - write (fd, tmp, 3); - continue; - } - if (d == 253 || d == 254) - { - tmp[0] = 255; - tmp[1] = 252; - tmp[2] = e; - write (fd, tmp, 3); - continue; - } - if (d == 250) - { - while (e != 240 && pp < max) - e = buf[pp++]; - tmp[0] = 255; - tmp[1] = 250; - tmp[2] = 24; - tmp[3] = 0; - tmp[4] = 65; - tmp[5] = 78; - tmp[6] = 83; - tmp[7] = 73; - tmp[8] = 255; - tmp[9] = 240; - write (fd, tmp, 10); - } + t1 = strtok(t, " \t"); + t2 = strtok(NULL, " \t\n"); + t3 = strtok(NULL, " \t\n"); + t4 = strtok(NULL, " \t\n"); + + if (t1[0] == '#' || t1[0] == '*' || t1 == NULL || t2 == NULL || t3 == NULL) + continue; + strncpy(bbsnet_conf[item_count].host1, t2, 18); + bbsnet_conf[item_count].host1[18] = 0; + strncpy(bbsnet_conf[item_count].host2, t1, 36); + bbsnet_conf[item_count].host2[36] = 0; + strncpy(bbsnet_conf[item_count].ip, t3, 36); + bbsnet_conf[item_count].ip[36] = 0; + bbsnet_conf[item_count].port = t4 ? atoi(t4) : 23; + + p_menuitem = p_menu->items[item_count] = malloc(sizeof(MENU_ITEM)); + p_menuitem->row = 2 + item_count / STATION_PER_LINE; + p_menuitem->col = 5 + item_count % STATION_PER_LINE * 20; + sprintf(p_menuitem->action, "%d", item_count); + p_menuitem->submenu = 0; + p_menuitem->priv = 0; + p_menuitem->level = 0; + p_menuitem->display = 0; + p_menuitem->name[0] = + (item_count < MAXSTATION / 2 ? 'A' + item_count : 'a' + item_count); + p_menuitem->name[1] = '\0'; + sprintf(p_menuitem->text, "%c. %s", + p_menuitem->name[0], bbsnet_conf[item_count].host1); + + item_count++; } - else - outc (c); - } - iflush (); - return 0; + fclose(fp); + + p_menu->item_count = item_count; + p_menu->item_cur_pos = 0; + + bbsnet_menu.menu_count = 1; + bbsnet_menu.menu_select_depth = 0; + bbsnet_menu.p_menu_select[0] = bbsnet_menu.p_menu[0]; + + return 0; } static void -process_bar (int n, int len) +process_bar(int n, int len) { - char buf[256]; - char buf2[256]; - char *ptr; - char *ptr2; - char *ptr3; - - moveto (4, 0); - prints ("┌───────────────┐\n"); - sprintf (buf2, " %3d%% ", n * 100 / len); - ptr = buf; - ptr2 = buf2; - ptr3 = buf + n; - while (ptr != ptr3) - *ptr++ = *ptr2++; - *ptr++ = '\x1b'; - *ptr++ = '['; - *ptr++ = '4'; - *ptr++ = '4'; - *ptr++ = 'm'; - while (*ptr2 != '\0') - *ptr++ = *ptr2++; - *ptr++ = '\0'; - prints ("│\033[46m%s\033[m│\n", buf); - prints ("└───────────────┘\n"); + char buf[256]; + char buf2[256]; + char *ptr; + char *ptr2; + char *ptr3; + + moveto(4, 0); + prints("┌───────────────┐\r\n"); + sprintf(buf2, " %3d%% ", n * 100 / len); + ptr = buf; + ptr2 = buf2; + ptr3 = buf + n; + while (ptr != ptr3) + *ptr++ = *ptr2++; + *ptr++ = '\x1b'; + *ptr++ = '['; + *ptr++ = '4'; + *ptr++ = '4'; + *ptr++ = 'm'; + while (*ptr2 != '\0') + *ptr++ = *ptr2++; + *ptr++ = '\0'; + prints("│\033[46m%s\033[m│\r\n", buf); + prints("└───────────────┘\r\n"); + iflush(); } -int -bbsnet_connect (int n) +int bbsnet_connect(int n) { - int sock, ch, result, len, loop; - struct sockaddr_in sin; - char buf[256]; - time_t now, t_last_action; - fd_set inputs, testfds; - struct timeval timeout; - struct hostent *pHost = NULL; - int rc, rv, tos = 020, i; - - prints ("\033[1;32m正在测试往 %s (%s) 的连接,请稍候... \033[m\n", - bbsnet_conf[n].host1, bbsnet_conf[n].ip); - prints ("\033[1;32m如果在 %d 秒内无法连上,穿梭程序将放弃连接。\033[m\n", - TIME_OUT); - - pHost = gethostbyname (bbsnet_conf[n].ip); - - if (pHost == NULL) - { - prints ("\033[1;31m查找主机名失败!\033[m\n"); - press_any_key (); - return -1; - } - - sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); - - if (sock < 0) - { - prints ("\033[1;31m无法创建socket!\033[m\n"); - press_any_key (); - return -1; - } - - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = - (strlen (hostaddr_server) > 0 ? inet_addr (hostaddr_server) : INADDR_ANY); - sin.sin_port = 0; - - if (bind (sock, (struct sockaddr *) &sin, sizeof (sin)) < 0) - { - log_error ("Bind address %s:%u failed\n", - inet_ntoa (sin.sin_addr), ntohs (sin.sin_port)); - return -2; - } - - bzero (&sin, sizeof (sin)); - sin.sin_family = AF_INET; - sin.sin_port = htons (bbsnet_conf[n].port); - sin.sin_addr = *(struct in_addr *) pHost->h_addr_list[0]; - - - prints ("\033[1;32m穿梭进度条提示您当前已使用的时间。\033[m\n"); - process_bar (0, MAX_PROCESS_BAR_LEN); - for (i = 0; i < MAX_PROCESS_BAR_LEN; i++) - { - if (i == 0) - rv = - NonBlockConnectEx (sock, (struct sockaddr *) &sin, sizeof (sin), - 500, 1); - else - rv = - NonBlockConnectEx (sock, (struct sockaddr *) &sin, sizeof (sin), - 500, 0); - if (rv == ERR_TCPLIB_TIMEOUT) + int sock, ch, result, len, loop; + struct sockaddr_in sin; + char buf[256]; + fd_set inputs, testfds; + struct timeval timeout; + struct hostent *pHost = NULL; + int rc, rv, tos = 020, i; + char remote_addr[256]; + int remote_port; + time_t t_used; + struct tm *tm_used; + + clearscr(); + + moveto(0, 0); + prints("\033[1;32m正在测试往 %s (%s) 的连接,请稍候... \033[m\r\n", + bbsnet_conf[n].host1, bbsnet_conf[n].ip); + prints("\033[1;32m如果在 %d 秒内无法连上,穿梭程序将放弃连接。\033[m\r\n", + TIME_OUT); + iflush(); + + pHost = gethostbyname(bbsnet_conf[n].ip); + + if (pHost == NULL) { - process_bar (i + 1, MAX_PROCESS_BAR_LEN); - continue; + prints("\033[1;31m查找主机名失败!\033[m\r\n"); + press_any_key(); + return -1; } - else if (rv == 0) - break; - else + + sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + + if (sock < 0) { - prints ("\033[1;31m连接失败!\033[m\n"); - press_any_key (); - return -1; + prints("\033[1;31m无法创建socket!\033[m\r\n"); + press_any_key(); + return -1; } - } - if (i == MAX_PROCESS_BAR_LEN) - { - prints ("\033[1;31m连接超时!\033[m\n"); - press_any_key (); - return -1; - } - setsockopt (sock, IPPROTO_IP, IP_TOS, &tos, sizeof (int)); - prints ("\033[1;31m连接成功!\033[m\n"); - -/* - if (connect (sock, (struct sockaddr *) &sin, sizeof (struct sockaddr)) < 0) - { - log_error ("Socket connect failed\n"); - return -3; - } -*/ - - FD_ZERO (&inputs); - FD_SET (0, &inputs); - FD_SET (sock, &inputs); - - t_last_action = time (0); - - loop = 1; - - while (loop) - { - testfds = inputs; - timeout.tv_sec = 0; - timeout.tv_usec = 100000; - result = select (FD_SETSIZE, &testfds, (fd_set *) NULL, - (fd_set *) NULL, &timeout); + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = + (strlen(hostaddr_server) > 0 ? inet_addr(hostaddr_server) : INADDR_ANY); + sin.sin_port = 0; - switch (result) + if (bind(sock, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - case 0: - break; - case -1: - log_error ("select() error!\n"); - break; - default: - if (FD_ISSET (0, &testfds)) - { - len = read (0, buf, 255); - if (len == 0) + log_error("Bind address %s:%u failed\n", + inet_ntoa(sin.sin_addr), ntohs(sin.sin_port)); + return -2; + } + + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_addr = *(struct in_addr *)pHost->h_addr_list[0]; + sin.sin_port = htons(bbsnet_conf[n].port); + + strcpy(remote_addr, inet_ntoa(sin.sin_addr)); + remote_port = ntohs(sin.sin_port); + + prints("\033[1;32m穿梭进度条提示您当前已使用的时间。\033[m\r\n"); + process_bar(0, MAX_PROCESS_BAR_LEN); + for (i = 0; i < MAX_PROCESS_BAR_LEN; i++) + { + if (i == 0) + rv = + NonBlockConnectEx(sock, (struct sockaddr *)&sin, sizeof(sin), + 500, 1); + else + rv = + NonBlockConnectEx(sock, (struct sockaddr *)&sin, sizeof(sin), + 500, 0); + if (rv == ERR_TCPLIB_TIMEOUT) { - loop = 0; - break; + process_bar(i + 1, MAX_PROCESS_BAR_LEN); + continue; } - write (sock, buf, len); - } - if (FD_ISSET (sock, &testfds)) - { - len = read (sock, buf, 255); - if (len == 0) + else if (rv == 0) + break; + else { - loop = 0; - break; + prints("\033[1;31m连接失败!\033[m\r\n"); + press_any_key(); + return -1; } - write (1, buf, len); - } - break; } - if (time (0) - t_last_action >= 10) + if (i == MAX_PROCESS_BAR_LEN) { - t_last_action = time (0); + prints("\033[1;31m连接超时!\033[m\r\n"); + press_any_key(); + return -1; } - } + setsockopt(sock, IPPROTO_IP, IP_TOS, &tos, sizeof(int)); + + prints("\033[1;31m连接成功!\033[m\r\n"); + log_std("BBSNET connect to %s:%d\n", remote_addr, remote_port); + + FD_ZERO(&inputs); + FD_SET(0, &inputs); + FD_SET(sock, &inputs); + + BBS_last_access_tm = t_used = time(0); - if (close (sock) == -1) - { - log_error ("Close socket failed\n"); - } + loop = 1; - return 0; + while (loop) + { + testfds = inputs; + timeout.tv_sec = TIME_OUT; + timeout.tv_usec = 0; + + result = SignalSafeSelect(FD_SETSIZE, &testfds, (fd_set *)NULL, + (fd_set *)NULL, &timeout); + + if (result == 0) + { + if (time(0) - BBS_last_access_tm >= MAX_DELAY_TIME) + { + loop = 0; + } + } + if (result < 0) + { + log_error("select() error (%d) !\n", result); + loop = 0; + } + if (result > 0) + { + if (FD_ISSET(0, &testfds)) + { + len = read(0, buf, 255); + if (len == 0) + { + loop = 0; + } + write(sock, buf, len); + } + if (FD_ISSET(sock, &testfds)) + { + len = read(sock, buf, 255); + if (len == 0) + { + loop = 0; + } + write(1, buf, len); + } + BBS_last_access_tm = time(0); + } + } + + if (close(sock) == -1) + { + log_error("Close socket failed\n"); + } + + t_used = time(0) - t_used; + tm_used = gmtime(&t_used); + + log_std("BBSNET disconnect, %d days %d hours %d minutes %d seconds used\n", + tm_used->tm_mday - 1, tm_used->tm_hour, tm_used->tm_min, + tm_used->tm_sec); + + return 0; } static int -bbsnet_refresh () +bbsnet_refresh() { - int i; + int i; - clearscr (); - moveto (1, 0); - prints - ("╭══════════════════════════════════════╮"); - for (i = 2; i < 19; i++) - { - moveto (i, 0); - prints ("║"); - moveto (i, 79); - prints ("║"); - } - moveto (19, 0); - prints - ("║——————————————————————————————————————║"); - moveto (22, 0); - prints - ("╰══════════════════════════════════════╯"); - moveto (23, 0); - prints - (" [\x1b[1;32mCtrl+C\x1b[m]退出 [\x1b[1;32m^\x1b[m]第一个 [\x1b[1;32m$\x1b[m]最后一个\033[0;37m\033[m"); - iflush (); + clearscr(); + moveto(1, 0); + prints("╭══════════════════════════════════════╮"); + for (i = 2; i < 19; i++) + { + moveto(i, 0); + prints("║"); + moveto(i, 79); + prints("║"); + } + moveto(19, 0); + prints("║——————————————————————————————————————║"); + moveto(22, 0); + prints("╰══════════════════════════════════════╯"); + moveto(23, 0); + prints(" [\x1b[1;32mCtrl+C\x1b[m]退出"); + + iflush(); - return 0; + return 0; } -int -bbsnet_selchange (int new_pos) +int bbsnet_selchange(int new_pos) { - moveto (20, 0); - clrtoeol (); - prints ("║\x1b[1m单位:\x1b[1;33m%-18s\x1b[m 站名:\x1b[1;33m%s\x1b[m", - bbsnet_conf[new_pos].host1, bbsnet_conf[new_pos].host2); - moveto (20, 79); - prints ("║"); - moveto (21, 0); - clrtoeol (); - prints ("║\x1b[1m连往:\x1b[1;33m%-20s", bbsnet_conf[new_pos].ip); - if (bbsnet_conf[new_pos].port != 23) - prints (" %d", bbsnet_conf[new_pos].port); - prints ("\x1b[m"); - moveto (21, 79); - prints ("║"); - iflush (); + moveto(20, 0); + clrtoeol(); + prints("║\x1b[1m单位:\x1b[1;33m%-18s\x1b[m 站名:\x1b[1;33m%s\x1b[m", + bbsnet_conf[new_pos].host2, bbsnet_conf[new_pos].host1); + moveto(20, 79); + prints("║"); + moveto(21, 0); + clrtoeol(); + prints("║\x1b[1m连往:\x1b[1;33m%-20s", bbsnet_conf[new_pos].ip); + if (bbsnet_conf[new_pos].port != 23) + prints(" %d", bbsnet_conf[new_pos].port); + prints("\x1b[m"); + moveto(21, 79); + prints("║"); + iflush(); - return 0; + return 0; } -int -bbs_net () +int bbs_net() { - int ch, result, pos; - char file_config[256]; - time_t t_last_action; - fd_set inputs, testfds; - struct timeval timeout; - - strcpy (file_config, app_home_dir); - strcat (file_config, "conf/bbsnet.conf"); - - load_bbsnet_conf (file_config); - - FD_ZERO (&inputs); - FD_SET (0, &inputs); - - t_last_action = time (0); - - clearscr (); - bbsnet_refresh (); - pos = bbsnet_menu.p_menu[0]->item_cur_pos; - display_menu (get_menu (&bbsnet_menu, "BBSNET")); - bbsnet_selchange (pos); - - while (1) - { - testfds = inputs; - timeout.tv_sec = 0; - timeout.tv_usec = 100000; - - result = select (FD_SETSIZE, &testfds, (fd_set *) NULL, - (fd_set *) NULL, &timeout); - switch (result) + int ch, pos, i; + char file_config[256]; + + strcpy(file_config, app_home_dir); + strcat(file_config, "conf/bbsnet.conf"); + + load_bbsnet_conf(file_config); + + BBS_last_access_tm = time(0); + + clearscr(); + bbsnet_refresh(); + pos = bbsnet_menu.p_menu[0]->item_cur_pos; + display_menu(get_menu(&bbsnet_menu, "BBSNET")); + bbsnet_selchange(pos); + + while (1) { - case 0: - break; - case -1: - log_error ("select() error!\n"); - break; - default: - if (FD_ISSET (0, &testfds)) - { - ch = igetch (); - switch (ch) + ch = igetch(0); + switch (ch) { case KEY_NULL: - case Ctrl ('C'): - return 0; + case Ctrl('C'): + return 0; + case KEY_TIMEOUT: + if (time(0) - BBS_last_access_tm >= MAX_DELAY_TIME) + { + return -1; + } + continue; case CR: - pos = bbsnet_menu.p_menu[0]->item_cur_pos; - bbsnet_connect (pos); - bbsnet_refresh (); - display_current_menu (&bbsnet_menu); - bbsnet_selchange (pos); - break; + pos = bbsnet_menu.p_menu[0]->item_cur_pos; + bbsnet_connect(pos); + bbsnet_refresh(); + display_current_menu(&bbsnet_menu); + bbsnet_selchange(pos); + break; case KEY_UP: - menu_control (&bbsnet_menu, KEY_UP); - menu_control (&bbsnet_menu, KEY_UP); - menu_control (&bbsnet_menu, KEY_UP); - pos = bbsnet_menu.p_menu[0]->item_cur_pos; - bbsnet_selchange (pos); - break; + for (i = 0; i < STATION_PER_LINE; i++) + menu_control(&bbsnet_menu, KEY_UP); + pos = bbsnet_menu.p_menu[0]->item_cur_pos; + bbsnet_selchange(pos); + break; case KEY_DOWN: - menu_control (&bbsnet_menu, KEY_DOWN); - menu_control (&bbsnet_menu, KEY_DOWN); - menu_control (&bbsnet_menu, KEY_DOWN); - pos = bbsnet_menu.p_menu[0]->item_cur_pos; - bbsnet_selchange (pos); - break; + for (i = 0; i < STATION_PER_LINE; i++) + menu_control(&bbsnet_menu, KEY_DOWN); + pos = bbsnet_menu.p_menu[0]->item_cur_pos; + bbsnet_selchange(pos); + break; case KEY_LEFT: - menu_control (&bbsnet_menu, KEY_UP); - pos = bbsnet_menu.p_menu[0]->item_cur_pos; - bbsnet_selchange (pos); - break; + menu_control(&bbsnet_menu, KEY_UP); + pos = bbsnet_menu.p_menu[0]->item_cur_pos; + bbsnet_selchange(pos); + break; case KEY_RIGHT: - menu_control (&bbsnet_menu, KEY_DOWN); - pos = bbsnet_menu.p_menu[0]->item_cur_pos; - bbsnet_selchange (pos); - break; - case '^': - pos = bbsnet_menu.p_menu[0]->item_cur_pos = 0; - bbsnet_selchange (pos); - break; - case '$': - pos = bbsnet_menu.p_menu[0]->item_cur_pos - = bbsnet_menu.p_menu[0]->item_count - 1; - if (pos < 0) - pos = 0; - bbsnet_selchange (pos); - break; + menu_control(&bbsnet_menu, KEY_DOWN); + pos = bbsnet_menu.p_menu[0]->item_cur_pos; + bbsnet_selchange(pos); + break; default: - break; + menu_control(&bbsnet_menu, ch); + pos = bbsnet_menu.p_menu[0]->item_cur_pos; + bbsnet_selchange(pos); + break; } - } - break; - } - if (time (0) - t_last_action >= 10) - { - t_last_action = time (0); + BBS_last_access_tm = time(0); } - } - return 0; + return 0; }