/[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.10 by sysadm, Sat May 7 12:08:28 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 <signal.h>
22    #include <sys/param.h>
23    #include <sys/types.h>
24    #include <sys/stat.h>
25    #include <unistd.h>
26    
27  void  void
28  init_daemon (void)  init_daemon (void)
# Line 36  init_daemon (void) Line 42  init_daemon (void)
42    else if (pid < 0)    else if (pid < 0)
43      exit (1);      exit (1);
44    
   for (i = 0; i < NOFILE; ++i)  
     close (i);  
   chdir (app_home_dir);  
45    umask (0);    umask (0);
46    
   signal (SIGCHLD, SIG_IGN);  
   
47    return;    return;
48  }  }
49    
50  int  int
51  load_conf (const char *conf_file)  load_conf (const char *conf_file)
52  {  {
53    // 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;  
54    
55    // Load configuration    // Load configuration
56    char c_name[256];    char c_name[256];
# Line 67  load_conf (const char *conf_file) Line 58  load_conf (const char *conf_file)
58    
59    if ((fin = fopen (conf_file, "r")) == NULL)    if ((fin = fopen (conf_file, "r")) == NULL)
60      {      {
61        log_error ("Open bbsd.conf failed");        log_error ("Open %s failed", conf_file);
62        return -1;        return -1;
63      }      }
64    
65    while (fscanf (fin, "%s", c_name) != EOF)    while (fscanf (fin, "%s", c_name) != EOF)
66      {      {
67        if (c_name[0] == '#')        if (c_name[0] == '#')
68          continue;          {
69              fgets (temp, 256, fin);
70              continue;
71            }
72        fscanf (fin, "%*c");        fscanf (fin, "%*c");
73        if (strcmp (c_name, "bbs_id") == 0)        if (strcmp (c_name, "bbs_id") == 0)
74          {          {
# Line 100  load_conf (const char *conf_file) Line 94  load_conf (const char *conf_file)
94          {          {
95            fscanf (fin, "%d", &BBS_max_client);            fscanf (fin, "%d", &BBS_max_client);
96          }          }
97          if (strcmp (c_name, "bbs_max_user") == 0)
98            {
99              fscanf (fin, "%d", &BBS_max_user);
100            }
101          if (strcmp (c_name, "bbs_start_dt") == 0)
102            {
103              int y = 0, m = 0, d = 0;
104              fscanf (fin, "%d-%d-%d", &y, &m, &d);
105              sprintf (BBS_start_dt, "%4dÄê%2dÔÂ%2dÈÕ", y, m, d);
106            }
107        if (strcmp (c_name, "db_host") == 0)        if (strcmp (c_name, "db_host") == 0)
108          {          {
109            fscanf (fin, "%s", DB_host);            fscanf (fin, "%s", DB_host);
# Line 112  load_conf (const char *conf_file) Line 116  load_conf (const char *conf_file)
116          {          {
117            fscanf (fin, "%s", DB_password);            fscanf (fin, "%s", DB_password);
118          }          }
119          if (strcmp (c_name, "db_database") == 0)
120            {
121              fscanf (fin, "%s", DB_database);
122            }
123      }      }
124    
125    fclose (fin);    fclose (fin);
126      
127    return 0;    return 0;
128  }  }


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

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