/[LeafOK_CVS]/lbbs/src/init.c
ViewVC logotype

Diff of /lbbs/src/init.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.22 by sysadm, Wed Jun 4 13:27:09 2025 UTC Revision 1.32 by sysadm, Tue Nov 4 13:49:51 2025 UTC
# Line 1  Line 1 
1  /***************************************************************************  /* SPDX-License-Identifier: GPL-3.0-or-later */
2                                                    init.c  -  description  /*
3                                                           -------------------   * init
4          Copyright            : (C) 2004-2025 by Leaflet   *   - initializer of server daemon
5          Email                : leaflet@leafok.com   *
6   ***************************************************************************/   * Copyright (C) 2004-2025 by Leaflet <leaflet@leafok.com>
7     */
 /***************************************************************************  
  *                                                                         *  
  *   This program is free software; you can redistribute it and/or modify  *  
  *   it under the terms of the GNU General Public License as published by  *  
  *   the Free Software Foundation; either version 3 of the License, or     *  
  *   (at your option) any later version.                                   *  
  *                                                                         *  
  ***************************************************************************/  
8    
 #include "init.h"  
 #include "database.h"  
9  #include "bbs.h"  #include "bbs.h"
10  #include "common.h"  #include "common.h"
11  #include "log.h"  #include "database.h"
12    #include "init.h"
13  #include "io.h"  #include "io.h"
14  #include <string.h>  #include "log.h"
 #include <stdlib.h>  
15  #include <signal.h>  #include <signal.h>
16    #include <stdlib.h>
17    #include <string.h>
18    #include <unistd.h>
19  #include <sys/param.h>  #include <sys/param.h>
 #include <sys/types.h>  
20  #include <sys/stat.h>  #include <sys/stat.h>
21  #include <unistd.h>  #include <sys/types.h>
22    
23  #define CONF_DELIM_WITH_SPACE " \t\r\n"  #define CONF_DELIM_WITH_SPACE " \t\r\n"
24    
# Line 71  int load_conf(const char *conf_file) Line 63  int load_conf(const char *conf_file)
63          char *saveptr = NULL;          char *saveptr = NULL;
64          char *p, *q, *r;          char *p, *q, *r;
65          char *y, *m, *d;          char *y, *m, *d;
66            int v;
67          FILE *fin;          FILE *fin;
68    
69          // Load configuration          // Load configuration
# Line 130  int load_conf(const char *conf_file) Line 123  int load_conf(const char *conf_file)
123                  }                  }
124                  else if (strcasecmp(p, "bbs_port") == 0)                  else if (strcasecmp(p, "bbs_port") == 0)
125                  {                  {
126                          BBS_port = (in_port_t)atoi(q);                          BBS_port[0] = (in_port_t)atoi(q);
127                  }                  }
128                  else if (strcasecmp(p, "bbs_ssh") == 0)                  else if (strcasecmp(p, "bbs_ssh_port") == 0)
129                  {                  {
130                          BBS_ssh_v2 = (strcasecmp(q, "v2") == 0 ? 1 : 0);                          BBS_port[1] = (in_port_t)atoi(q);
131                  }                  }
132                  else if (strcasecmp(p, "bbs_max_client") == 0)                  else if (strcasecmp(p, "bbs_max_client") == 0)
133                  {                  {
# Line 154  int load_conf(const char *conf_file) Line 147  int load_conf(const char *conf_file)
147                                  BBS_max_client_per_ip = MAX_CLIENT_PER_IP_LIMIT;                                  BBS_max_client_per_ip = MAX_CLIENT_PER_IP_LIMIT;
148                          }                          }
149                  }                  }
                 else if (strcasecmp(p, "bbs_max_user") == 0)  
                 {  
                         BBS_max_user = atoi(q);  
                         if (BBS_max_user <= 0 || BBS_max_user > BBS_MAX_USER_LIMIT)  
                         {  
                                 log_error("Ignore config bbs_max_client with incorrect value %d\n", BBS_max_user);  
                                 BBS_max_user = BBS_MAX_USER_LIMIT;  
                         }  
                 }  
150                  else if (strcasecmp(p, "bbs_start_dt") == 0)                  else if (strcasecmp(p, "bbs_start_dt") == 0)
151                  {                  {
152                          y = strtok_r(q, "-", &saveptr);                          y = strtok_r(q, "-", &saveptr);
# Line 174  int load_conf(const char *conf_file) Line 158  int load_conf(const char *conf_file)
158                                  log_error("Ignore config bbs_start_dt with incorrect value\n");                                  log_error("Ignore config bbs_start_dt with incorrect value\n");
159                                  continue;                                  continue;
160                          }                          }
161                          snprintf(BBS_start_dt, sizeof(BBS_start_dt), "%4sÄê%2sÔÂ%2sÈÕ", y, m, d);                          snprintf(BBS_start_dt, sizeof(BBS_start_dt), "%4så¹´%2s月%2sæ—¥", y, m, d);
162                    }
163                    else if (strcasecmp(p, "bbs_sys_id") == 0)
164                    {
165                            v = atoi(q);
166                            if (v <= 0)
167                            {
168                                    log_error("Ignore config bbs_sys_id with incorrect value %d\n", v);
169                                    continue;
170                            }
171                            BBS_sys_id = v;
172                  }                  }
173                  else if (strcasecmp(p, "db_host") == 0)                  else if (strcasecmp(p, "db_host") == 0)
174                  {                  {


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

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