--- lbbs/src/init.c 2025/06/16 14:30:44 1.25 +++ lbbs/src/init.c 2025/11/04 13:49:51 1.32 @@ -1,35 +1,24 @@ -/*************************************************************************** - init.c - description - ------------------- - Copyright : (C) 2004-2025 by Leaflet - Email : leaflet@leafok.com - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* + * init + * - initializer of server daemon + * + * Copyright (C) 2004-2025 by Leaflet + */ -#define _POSIX_C_SOURCE 200809L - -#include "init.h" -#include "database.h" #include "bbs.h" #include "common.h" -#include "log.h" +#include "database.h" +#include "init.h" #include "io.h" -#include -#include -#include +#include "log.h" #include +#include +#include #include #include -#include #include +#include #define CONF_DELIM_WITH_SPACE " \t\r\n" @@ -74,6 +63,7 @@ int load_conf(const char *conf_file) char *saveptr = NULL; char *p, *q, *r; char *y, *m, *d; + int v; FILE *fin; // Load configuration @@ -157,15 +147,6 @@ int load_conf(const char *conf_file) BBS_max_client_per_ip = MAX_CLIENT_PER_IP_LIMIT; } } - 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; - } - } else if (strcasecmp(p, "bbs_start_dt") == 0) { y = strtok_r(q, "-", &saveptr); @@ -177,7 +158,17 @@ int load_conf(const char *conf_file) log_error("Ignore config bbs_start_dt with incorrect value\n"); continue; } - 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); + } + else if (strcasecmp(p, "bbs_sys_id") == 0) + { + v = atoi(q); + if (v <= 0) + { + log_error("Ignore config bbs_sys_id with incorrect value %d\n", v); + continue; + } + BBS_sys_id = v; } else if (strcasecmp(p, "db_host") == 0) {