--- lbbs/src/main.c 2004/10/18 08:16:18 1.1 +++ lbbs/src/main.c 2004/10/18 11:34:15 1.3 @@ -1,5 +1,5 @@ /*************************************************************************** - bbsd.c - description + main.c - description ------------------- begin : Mon Oct 11 2004 copyright : (C) 2004 by Leaflet @@ -17,24 +17,45 @@ #include "common.h" +char app_home_dir[256]; + int main (int argc, char *argv[]) { - FILE *fp; - time_t t; - + char log_dir[256], file_log_std[256], file_log_error[256]; + + //Initialize daemon init_daemon (); + //Initialize log + strncpy(app_home_dir,argv[0],rindex(argv[0],'/')-argv[0]+1); + strcpy(log_dir,app_home_dir); + strcat(log_dir,"log/"); + strcpy(file_log_std,log_dir); + strcpy(file_log_error,log_dir); + strcat(file_log_std,"bbsd.log"); + strcat(file_log_error,"error.log"); + mkdir(log_dir,0700); + log_begin(file_log_std,file_log_error); + + //Initialize socket server + net_server("",2323); + +/* + FILE *fp; + time_t t; + while (1) - { - sleep (60); - if ((fp = fopen ("bbsd.log", "a")) >= 0) + { + sleep (60); + if ((fp = fopen ("bbsd.log", "a")) >= 0) { t = time (0); fprintf (fp, "I'm here at %s\n", asctime (localtime (&t))); fclose (fp); } - } + } +*/ return 0; }