/[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.23 by sysadm, Mon May 5 11:59:18 2025 UTC Revision 1.25 by sysadm, Tue May 6 05:31:26 2025 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2                                                    bbs_net.c  -  description                                                    bbs_net.c  -  description
3                                                           -------------------                                                           -------------------
4          begin                : Mon Oct 18 2004          Copyright            : (C) 2004-2025 by Leaflet
5          copyright            : (C) 2004 by Leaflet          Email                : leaflet@leafok.com
         email                : leaflet@leafok.com  
6   ***************************************************************************/   ***************************************************************************/
7    
8  /***************************************************************************  /***************************************************************************
9   *                                                                         *   *                                                                         *
10   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
11   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
12   *   the Free Software Foundation; either version 2 of the License, or     *   *   the Free Software Foundation; either version 3 of the License, or     *
13   *   (at your option) any later version.                                   *   *   (at your option) any later version.                                   *
14   *                                                                         *   *                                                                         *
15   ***************************************************************************/   ***************************************************************************/
# Line 42  struct _bbsnet_conf Line 41  struct _bbsnet_conf
41          char host1[20];          char host1[20];
42          char host2[40];          char host2[40];
43          char ip[40];          char ip[40];
44          int port;          in_port_t port;
45  } bbsnet_conf[MAXSTATION];  } bbsnet_conf[MAXSTATION];
46    
47  MENU_SET bbsnet_menu;  MENU_SET bbsnet_menu;
# Line 85  int load_bbsnet_conf(const char *file_co Line 84  int load_bbsnet_conf(const char *file_co
84                  bbsnet_conf[item_count].host2[sizeof(bbsnet_conf[item_count].host2) - 1] = '\0';                  bbsnet_conf[item_count].host2[sizeof(bbsnet_conf[item_count].host2) - 1] = '\0';
85                  strncpy(bbsnet_conf[item_count].ip, t3, sizeof(bbsnet_conf[item_count].ip) - 1);                  strncpy(bbsnet_conf[item_count].ip, t3, sizeof(bbsnet_conf[item_count].ip) - 1);
86                  bbsnet_conf[item_count].ip[sizeof(bbsnet_conf[item_count].ip) - 1] = '\0';                  bbsnet_conf[item_count].ip[sizeof(bbsnet_conf[item_count].ip) - 1] = '\0';
87                  bbsnet_conf[item_count].port = t4 ? atoi(t4) : 23;                  bbsnet_conf[item_count].port = (in_port_t)(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));
90                  p_menuitem->row = 2 + item_count / STATION_PER_LINE;                  p_menuitem->row = 2 + item_count / STATION_PER_LINE;
# Line 96  int load_bbsnet_conf(const char *file_co Line 95  int load_bbsnet_conf(const char *file_co
95                  p_menuitem->level = 0;                  p_menuitem->level = 0;
96                  p_menuitem->display = 0;                  p_menuitem->display = 0;
97                  p_menuitem->name[0] =                  p_menuitem->name[0] =
98                          (item_count < MAXSTATION / 2 ? 'A' + item_count : 'a' + item_count);                          (char)(item_count < MAXSTATION / 2 ? 'A' + item_count : 'a' + item_count);
99                  p_menuitem->name[1] = '\0';                  p_menuitem->name[1] = '\0';
100                  snprintf(p_menuitem->text, sizeof(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], bbsnet_conf[item_count].host1);
# Line 146  static void process_bar(int n, int len) Line 145  static void process_bar(int n, int len)
145    
146  int bbsnet_connect(int n)  int bbsnet_connect(int n)
147  {  {
148          int sock, result, len, loop;          int sock, result, loop;
149            ssize_t len;
150          struct sockaddr_in sin;          struct sockaddr_in sin;
151          char buf[256];          char buf[256];
152          fd_set inputs, testfds;          fd_set inputs, testfds;
# Line 283  int bbsnet_connect(int n) Line 283  int bbsnet_connect(int n)
283                                  {                                  {
284                                          loop = 0;                                          loop = 0;
285                                  }                                  }
286                                  write(sock, buf, len);                                  write(sock, buf, (size_t)len);
287                          }                          }
288                          if (FD_ISSET(sock, &testfds))                          if (FD_ISSET(sock, &testfds))
289                          {                          {
# Line 292  int bbsnet_connect(int n) Line 292  int bbsnet_connect(int n)
292                                  {                                  {
293                                          loop = 0;                                          loop = 0;
294                                  }                                  }
295                                  write(1, buf, len);                                  write(1, buf, (size_t)len);
296                          }                          }
297                          BBS_last_access_tm = time(0);                          BBS_last_access_tm = time(0);
298                  }                  }


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

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