/[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.4 by sysadm, Tue Oct 19 17:11:39 2004 UTC Revision 1.7 by sysadm, Thu Mar 17 10:48:46 2005 UTC
# Line 17  Line 17 
17    
18  #include "bbs.h"  #include "bbs.h"
19  #include "common.h"  #include "common.h"
20    #include "io.h"
21    #include <unistd.h>
22    #include <signal.h>
23    #include <sys/param.h>
24    #include <sys/types.h>
25    #include <sys/stat.h>
26    
27  void  void
28  init_daemon (void)  init_daemon (void)
# Line 49  init_daemon (void) Line 55  init_daemon (void)
55  int  int
56  load_conf (const char *conf_file)  load_conf (const char *conf_file)
57  {  {
58    // Innd settings    char temp[256];
   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;  
59    
60    // Load configuration    // Load configuration
61    char c_name[256];    char c_name[256];
# Line 67  load_conf (const char *conf_file) Line 63  load_conf (const char *conf_file)
63    
64    if ((fin = fopen (conf_file, "r")) == NULL)    if ((fin = fopen (conf_file, "r")) == NULL)
65      {      {
66        log_error ("Open bbsd.conf failed");        log_error ("Open %s failed", conf_file);
67        return -1;        return -1;
68      }      }
69    
70    while (fscanf (fin, "%s", c_name) != EOF)    while (fscanf (fin, "%s", c_name) != EOF)
71      {      {
72        if (c_name[0] == '#')        if (c_name[0] == '#')
73          continue;        {
74            fgets(temp, 256, fin);
75            continue;
76          }
77        fscanf (fin, "%*c");        fscanf (fin, "%*c");
78        if (strcmp (c_name, "bbs_id") == 0)        if (strcmp (c_name, "bbs_id") == 0)
79          {          {
# Line 100  load_conf (const char *conf_file) Line 99  load_conf (const char *conf_file)
99          {          {
100            fscanf (fin, "%d", &BBS_max_client);            fscanf (fin, "%d", &BBS_max_client);
101          }          }
102          if (strcmp (c_name, "bbs_max_user") == 0)
103            {
104              fscanf (fin, "%d", &BBS_max_user);
105            }
106          if (strcmp (c_name, "bbs_start_dt") == 0)
107            {
108              int y = 0, m = 0, d = 0;
109              fscanf (fin, "%d-%d-%d", &y, &m, &d);
110              sprintf (BBS_start_dt, "%4dÄê%2dÔÂ%2dÈÕ",y,m,d);
111            }
112        if (strcmp (c_name, "db_host") == 0)        if (strcmp (c_name, "db_host") == 0)
113          {          {
114            fscanf (fin, "%s", DB_host);            fscanf (fin, "%s", DB_host);
# Line 112  load_conf (const char *conf_file) Line 121  load_conf (const char *conf_file)
121          {          {
122            fscanf (fin, "%s", DB_password);            fscanf (fin, "%s", DB_password);
123          }          }
124          if (strcmp (c_name, "db_database") == 0)
125            {
126              fscanf (fin, "%s", DB_database);
127            }
128      }      }
129    
130    fclose (fin);    fclose (fin);


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

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