/[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.97 by sysadm, Thu Dec 18 07:58:23 2025 UTC Revision 1.100 by sysadm, Thu Dec 18 08:38:55 2025 UTC
# Line 140  static int load_bbsnet_conf(const char * Line 140  static int load_bbsnet_conf(const char *
140                  port = strtol(t4, &endptr, 10);                  port = strtol(t4, &endptr, 10);
141                  if (*endptr != '\0' || port <= 0 || port > 65535)                  if (*endptr != '\0' || port <= 0 || port > 65535)
142                  {                  {
143                          log_error("Invalid port value %d of menu item %d\n", port, menu_item_id);                          log_error("Invalid port value %ld of menu item %d\n", port, menu_item_id);
144                          fclose(fp);                          fclose(fp);
145                          unload_bbsnet_conf();                          unload_bbsnet_conf();
146                          return -3;                          return -3;
# Line 212  static void progress_bar(int percent, in Line 212  static void progress_bar(int percent, in
212          char buf2[LINE_BUFFER_LEN];          char buf2[LINE_BUFFER_LEN];
213          int pos;          int pos;
214    
215          if (len <= 0)          if (len < 4)
216          {          {
217                  len = 1;                  len = 4;
218          }          }
219          else if (len > LINE_BUFFER_LEN)          else if (len + 2 > LINE_BUFFER_LEN)
220          {          {
221                  len = LINE_BUFFER_LEN - 1;                  len = LINE_BUFFER_LEN - 3;
222          }          }
223          if (percent < 0)          if (percent < 0)
224          {          {
# Line 573  static int bbsnet_connect(int n) Line 573  static int bbsnet_connect(int n)
573                                                           (ts_now.tv_nsec - ts_begin.tv_nsec) / 1000 / 1000) /                                                           (ts_now.tv_nsec - ts_begin.tv_nsec) / 1000 / 1000) /
574                                                     REMOTE_CONNECT_TIMEOUT / 10 +                                                     REMOTE_CONNECT_TIMEOUT / 10 +
575                                             1;                                             1;
576                            if (progress < 0)
577                            {
578                                    progress = 0;
579                            }
580                            if (progress > 100)
581                            {
582                                    progress = 100;
583                            }
584    
585                          if (progress > progress_last)                          if (progress > progress_last)
586                          {                          {
# Line 1313  static int bbsnet_connect(int n) Line 1321  static int bbsnet_connect(int n)
1321          ret = 1; // Normal disconnect          ret = 1; // Normal disconnect
1322          BBS_last_access_tm = time(NULL);          BBS_last_access_tm = time(NULL);
1323          t_used = BBS_last_access_tm - t_begin;          t_used = BBS_last_access_tm - t_begin;
1324          log_common("BBSNET disconnect, %d days %d hours %d minutes %d seconds used\n",          log_common("BBSNET disconnect, %ld days %ld hours %ld minutes %ld seconds used\n",
1325                             t_used / 86400, t_used % 86400 / 3600, t_used % 3600 / 60, t_used % 60);                             t_used / 86400, t_used % 86400 / 3600, t_used % 3600 / 60, t_used % 60);
1326    
1327  cleanup:  cleanup:
# Line 1425  static int bbsnet_selchange() Line 1433  static int bbsnet_selchange()
1433    
1434  int bbs_net()  int bbs_net()
1435  {  {
1436          int ch, i;          int ch;
1437    
1438          if (load_bbsnet_conf(CONF_BBSNET) < 0)          if (load_bbsnet_conf(CONF_BBSNET) < 0)
1439          {          {
# Line 1465  int bbs_net() Line 1473  int bbs_net()
1473                  case Ctrl('C'): // user cancel                  case Ctrl('C'): // user cancel
1474                          goto cleanup;                          goto cleanup;
1475                  case CR:                  case CR:
1476                          bbsnet_connect(bbsnet_menu.menu_item_pos[0]);                          if (bbsnet_connect(bbsnet_menu.menu_item_pos[0]) < 0)
1477                            {
1478                                    log_debug("bbsnet_connect() error\n");
1479                            }
1480                          // Force cleanup anything remaining in the output buffer                          // Force cleanup anything remaining in the output buffer
1481                          clearscr();                          clearscr();
1482                          iflush();                          iflush();
# Line 1475  int bbs_net() Line 1486  int bbs_net()
1486                          bbsnet_selchange();                          bbsnet_selchange();
1487                          break;                          break;
1488                  case KEY_UP:                  case KEY_UP:
1489                          for (i = 0; i < STATION_PER_LINE; i++)                          for (int i = 0; i < STATION_PER_LINE; i++)
1490                          {                          {
1491                                  menu_control(&bbsnet_menu, KEY_UP);                                  menu_control(&bbsnet_menu, KEY_UP);
1492                          }                          }
1493                          bbsnet_selchange();                          bbsnet_selchange();
1494                          break;                          break;
1495                  case KEY_DOWN:                  case KEY_DOWN:
1496                          for (i = 0; i < STATION_PER_LINE; i++)                          for (int i = 0; i < STATION_PER_LINE; i++)
1497                          {                          {
1498                                  menu_control(&bbsnet_menu, KEY_DOWN);                                  menu_control(&bbsnet_menu, KEY_DOWN);
1499                          }                          }


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

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