/[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.39 by sysadm, Tue May 13 07:31:48 2025 UTC Revision 1.40 by sysadm, Wed May 14 04:22:45 2025 UTC
# Line 67  int load_bbsnet_conf(const char *file_co Line 67  int load_bbsnet_conf(const char *file_co
67                  return -1;                  return -1;
68          }          }
69    
70          p_menu = bbsnet_menu.p_menu[0] = malloc(sizeof(MENU));          bbsnet_menu.p_menu_name_dict = trie_dict_create();
71    
72            p_menu = malloc(sizeof(MENU));
73            bbsnet_menu.p_menu[0] = p_menu;
74          strncpy(p_menu->name, "BBSNET", sizeof(p_menu->name) - 1);          strncpy(p_menu->name, "BBSNET", sizeof(p_menu->name) - 1);
75          p_menu->name[sizeof(p_menu->name) - 1] = '\0';          p_menu->name[sizeof(p_menu->name) - 1] = '\0';
76          p_menu->title.show = 0;          p_menu->title.show = 0;
77          p_menu->screen.show = 0;          p_menu->screen.show = 0;
78    
79            if (trie_dict_set(bbsnet_menu.p_menu_name_dict, p_menu->name, (int64_t)p_menu) != 1)
80            {
81                    log_error("Error set BBSNET menu dict [%s]\n", p_menu->name);
82            }
83    
84          while (fgets(t, 255, fp) && item_count < MAXSTATION)          while (fgets(t, 255, fp) && item_count < MAXSTATION)
85          {          {
86                  t1 = strtok_r(t, MENU_CONF_DELIM, &saveptr);                  t1 = strtok_r(t, MENU_CONF_DELIM, &saveptr);
# Line 121  int load_bbsnet_conf(const char *file_co Line 129  int load_bbsnet_conf(const char *file_co
129          return 0;          return 0;
130  }  }
131    
132  static void process_bar(int n, int len)  void unload_bbsnet_conf(void)
133    {
134            unload_menu(&bbsnet_menu);
135    }
136    
137    void process_bar(int n, int len)
138  {  {
139          char buf[LINE_BUFFER_LEN];          char buf[LINE_BUFFER_LEN];
140          char buf2[LINE_BUFFER_LEN];          char buf2[LINE_BUFFER_LEN];
# Line 663  int bbs_net() Line 676  int bbs_net()
676                  {                  {
677                  case KEY_NULL:  // broken pipe                  case KEY_NULL:  // broken pipe
678                  case Ctrl('C'): // user cancel                  case Ctrl('C'): // user cancel
679                          return 0;                          goto cleanup;
680                  case KEY_TIMEOUT:                  case KEY_TIMEOUT:
681                          if (time(0) - BBS_last_access_tm >= MAX_DELAY_TIME)                          if (time(0) - BBS_last_access_tm >= MAX_DELAY_TIME)
682                          {                          {
683                                  return 0;                                  goto cleanup;
684                          }                          }
685                          continue;                          continue;
686                  case CR:                  case CR:
# Line 712  int bbs_net() Line 725  int bbs_net()
725                  BBS_last_access_tm = time(0);                  BBS_last_access_tm = time(0);
726          }          }
727    
728    cleanup:
729            unload_bbsnet_conf();
730    
731          return 0;          return 0;
732  }  }


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

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