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

Annotation of /lbbs/src/main.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations)
Tue Oct 19 17:11:39 2004 UTC (21 years, 5 months ago) by sysadm
Branch: MAIN
Changes since 1.3: +18 -12 lines
Content type: text/x-csrc
*** empty log message ***

1 sysadm 1.1 /***************************************************************************
2 sysadm 1.3 main.c - description
3 sysadm 1.1 -------------------
4     begin : Mon Oct 11 2004
5     copyright : (C) 2004 by Leaflet
6     email : leaflet@leafok.com
7     ***************************************************************************/
8    
9     /***************************************************************************
10     * *
11     * This program is free software; you can redistribute it and/or modify *
12     * it under the terms of the GNU General Public License as published by *
13     * the Free Software Foundation; either version 2 of the License, or *
14     * (at your option) any later version. *
15     * *
16     ***************************************************************************/
17    
18 sysadm 1.4 #include "bbs.h"
19 sysadm 1.1 #include "common.h"
20    
21     int
22     main (int argc, char *argv[])
23     {
24 sysadm 1.4 char log_dir[256], file_log_std[256], file_log_error[256], file_config[256];
25 sysadm 1.3
26     //Initialize daemon
27     init_daemon ();
28    
29     //Initialize log
30 sysadm 1.4 strncpy(app_home_dir, argv[0], rindex(argv[0],'/')-argv[0]+1);
31     strcpy(log_dir, app_home_dir);
32     strcat(log_dir, "log/");
33     strcpy(file_log_std, log_dir);
34     strcpy(file_log_error, log_dir);
35     strcat(file_log_std, "bbsd.log");
36     strcat(file_log_error, "error.log");
37 sysadm 1.3 mkdir(log_dir,0700);
38 sysadm 1.4 if (log_begin(file_log_std,file_log_error)<0)
39     exit(-1);
40    
41     //Load configuration
42     strcpy(file_config, app_home_dir);
43     strcat(file_config, "conf/bbsd.conf");
44     if (load_conf(file_config)<0)
45     exit(-2);
46 sysadm 1.3
47     //Initialize socket server
48 sysadm 1.4 net_server(BBS_address, BBS_port);
49 sysadm 1.3
50     /*
51 sysadm 1.2 FILE *fp;
52     time_t t;
53 sysadm 1.1
54     while (1)
55 sysadm 1.2 {
56     sleep (60);
57     if ((fp = fopen ("bbsd.log", "a")) >= 0)
58 sysadm 1.1 {
59     t = time (0);
60     fprintf (fp, "I'm here at %s\n", asctime (localtime (&t)));
61     fclose (fp);
62     }
63 sysadm 1.2 }
64 sysadm 1.3 */
65 sysadm 1.1
66     return 0;
67     }

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