/[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.17 by sysadm, Sun May 4 14:54:55 2025 UTC Revision 1.19 by sysadm, Mon May 5 05:43:36 2025 UTC
# Line 52  int load_bbsnet_conf(const char *file_co Line 52  int load_bbsnet_conf(const char *file_co
52          FILE *fp;          FILE *fp;
53          MENU *p_menu;          MENU *p_menu;
54          MENU_ITEM *p_menuitem;          MENU_ITEM *p_menuitem;
55          char t[256], *t1, *t2, *t3, *t4;          char t[256], *t1, *t2, *t3, *t4, *saveptr;
56          int item_count = 0;          int item_count = 0;
57    
58          fp = fopen(file_config, "r");          fp = fopen(file_config, "r");
# Line 66  int load_bbsnet_conf(const char *file_co Line 66  int load_bbsnet_conf(const char *file_co
66    
67          while (fgets(t, 255, fp) && item_count < MAXSTATION)          while (fgets(t, 255, fp) && item_count < MAXSTATION)
68          {          {
69                  t1 = strtok(t, " \t");                  if (t[0] == '#' || t[0] == '*')
70                  t2 = strtok(NULL, " \t\n");                  {
71                  t3 = strtok(NULL, " \t\n");                          continue;
72                  t4 = strtok(NULL, " \t\n");                  }
73    
74                    t1 = strtok_r(t, " \t", &saveptr);
75                    t2 = strtok_r(NULL, " \t\n", &saveptr);
76                    t3 = strtok_r(NULL, " \t\n", &saveptr);
77                    t4 = strtok_r(NULL, " \t\n", &saveptr);
78    
79                  if (t1[0] == '#' || t1[0] == '*' || t1 == NULL || t2 == NULL || t3 == NULL)                  if (t1 == NULL || t2 == NULL || t3 == NULL)
80                    {
81                          continue;                          continue;
82                  strncpy(bbsnet_conf[item_count].host1, t2, 18);                  }
83                  bbsnet_conf[item_count].host1[18] = 0;  
84                  strncpy(bbsnet_conf[item_count].host2, t1, 36);                  strncpy(bbsnet_conf[item_count].host1, t2, sizeof(bbsnet_conf[item_count].host1));
85                  bbsnet_conf[item_count].host2[36] = 0;                  strncpy(bbsnet_conf[item_count].host2, t1, sizeof(bbsnet_conf[item_count].host2));
86                  strncpy(bbsnet_conf[item_count].ip, t3, 36);                  strncpy(bbsnet_conf[item_count].ip, t3, sizeof(bbsnet_conf[item_count].ip));
                 bbsnet_conf[item_count].ip[36] = 0;  
87                  bbsnet_conf[item_count].port = t4 ? atoi(t4) : 23;                  bbsnet_conf[item_count].port = t4 ? atoi(t4) : 23;
88    
89                  p_menuitem = p_menu->items[item_count] = malloc(sizeof(MENU_ITEM));                  p_menuitem = p_menu->items[item_count] = malloc(sizeof(MENU_ITEM));
# Line 92  int load_bbsnet_conf(const char *file_co Line 97  int load_bbsnet_conf(const char *file_co
97                  p_menuitem->name[0] =                  p_menuitem->name[0] =
98                          (item_count < MAXSTATION / 2 ? 'A' + item_count : 'a' + item_count);                          (item_count < MAXSTATION / 2 ? 'A' + item_count : 'a' + item_count);
99                  p_menuitem->name[1] = '\0';                  p_menuitem->name[1] = '\0';
100                  sprintf(p_menuitem->text, "%c. %s",                  snprintf(p_menuitem->text, sizeof(p_menuitem->text), "%c. %s",
101                                  p_menuitem->name[0], bbsnet_conf[item_count].host1);                                   p_menuitem->name[0], t2);
102    
103                  item_count++;                  item_count++;
104          }          }
# Line 119  process_bar(int n, int len) Line 124  process_bar(int n, int len)
124          char *ptr3;          char *ptr3;
125    
126          moveto(4, 0);          moveto(4, 0);
127          prints("©°©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©´\r\n");          prints("©°©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©´\r\n");
128          sprintf(buf2, "            %3d%%              ", n * 100 / len);          sprintf(buf2, "            %3d%%              ", n * 100 / len);
129          ptr = buf;          ptr = buf;
130          ptr2 = buf2;          ptr2 = buf2;
# Line 135  process_bar(int n, int len) Line 140  process_bar(int n, int len)
140                  *ptr++ = *ptr2++;                  *ptr++ = *ptr2++;
141          *ptr++ = '\0';          *ptr++ = '\0';
142          prints("©¦\033[46m%s\033[m©¦\r\n", buf);          prints("©¦\033[46m%s\033[m©¦\r\n", buf);
143          prints("©¸©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¼\r\n");          prints("©¸©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¤©¼\r\n");
144          iflush();          iflush();
145  }  }
146    
# Line 312  bbsnet_refresh() Line 317  bbsnet_refresh()
317    
318          clearscr();          clearscr();
319          moveto(1, 0);          moveto(1, 0);
320          prints("¨q¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨r");          prints("¨q¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨r");
321          for (i = 2; i < 19; i++)          for (i = 2; i < 19; i++)
322          {          {
323                  moveto(i, 0);                  moveto(i, 0);
# Line 321  bbsnet_refresh() Line 326  bbsnet_refresh()
326                  prints("¨U");                  prints("¨U");
327          }          }
328          moveto(19, 0);          moveto(19, 0);
329          prints("¨U¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¨U");          prints("¨U¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¨U");
330          moveto(22, 0);          moveto(22, 0);
331          prints("¨t¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨s");          prints("¨t¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨s");
332          moveto(23, 0);          moveto(23, 0);
333          prints(" [\x1b[1;32mCtrl+C\x1b[m]Í˳ö");          prints(" [\x1b[1;32mCtrl+C\x1b[m]Í˳ö");
334    


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

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