--- lbbs/src/init.c 2004/10/19 17:11:39 1.4 +++ lbbs/src/init.c 2005/05/07 12:08:28 1.10 @@ -17,6 +17,12 @@ #include "bbs.h" #include "common.h" +#include "io.h" +#include +#include +#include +#include +#include void init_daemon (void) @@ -36,30 +42,15 @@ init_daemon (void) else if (pid < 0) exit (1); - for (i = 0; i < NOFILE; ++i) - close (i); - chdir (app_home_dir); umask (0); - signal (SIGCHLD, SIG_IGN); - return; } int load_conf (const char *conf_file) { - // Innd settings - char innd_id[50] = ""; - char innd_name[50] = ""; - char innd_server[256] = ""; - unsigned long innd_uid = 0; - char innd_address[50] = ""; - unsigned int bbsd_port = 0; - unsigned int innd_port = 0; - unsigned int ctrl_port = 0; - char conn_str[256] = ""; - unsigned int if_startup = 0; + char temp[256]; // Load configuration char c_name[256]; @@ -67,14 +58,17 @@ load_conf (const char *conf_file) if ((fin = fopen (conf_file, "r")) == NULL) { - log_error ("Open bbsd.conf failed"); + log_error ("Open %s failed", conf_file); return -1; } while (fscanf (fin, "%s", c_name) != EOF) { if (c_name[0] == '#') - continue; + { + fgets (temp, 256, fin); + continue; + } fscanf (fin, "%*c"); if (strcmp (c_name, "bbs_id") == 0) { @@ -100,6 +94,16 @@ load_conf (const char *conf_file) { fscanf (fin, "%d", &BBS_max_client); } + if (strcmp (c_name, "bbs_max_user") == 0) + { + fscanf (fin, "%d", &BBS_max_user); + } + if (strcmp (c_name, "bbs_start_dt") == 0) + { + int y = 0, m = 0, d = 0; + fscanf (fin, "%d-%d-%d", &y, &m, &d); + sprintf (BBS_start_dt, "%4dÄê%2dÔÂ%2dÈÕ", y, m, d); + } if (strcmp (c_name, "db_host") == 0) { fscanf (fin, "%s", DB_host); @@ -112,9 +116,13 @@ load_conf (const char *conf_file) { fscanf (fin, "%s", DB_password); } + if (strcmp (c_name, "db_database") == 0) + { + fscanf (fin, "%s", DB_database); + } } fclose (fin); - + return 0; }