| 45 |
return 1; |
return 1; |
| 46 |
} |
} |
| 47 |
|
|
|
// TODO: 在此处为应用程序的行为编写代码。 |
|
|
|
|
| 48 |
// System settings |
// System settings |
| 49 |
const char* logfile_file = _T("innbbsd.log"); |
const char* conf_file = _T("innbbsd.conf"); |
| 50 |
|
const char* log_file = _T("innbbsd.log"); |
| 51 |
|
|
| 52 |
|
// Get application path |
| 53 |
|
CString app_path; |
| 54 |
|
int pos; |
| 55 |
|
|
| 56 |
|
app_path = argv[0]; |
| 57 |
|
pos = app_path.ReverseFind('\\'); |
| 58 |
|
if (pos != -1) |
| 59 |
|
app_path = app_path.Left(pos + 1); |
| 60 |
|
else |
| 61 |
|
app_path = ""; |
| 62 |
|
|
| 63 |
syslog.open(logfile_file,ios_base::out | ios_base::app); |
syslog.open(app_path + log_file, ios_base::out | ios_base::app); |
| 64 |
|
|
| 65 |
|
// Initialize sockets |
| 66 |
if(!AfxSocketInit()) |
if(!AfxSocketInit()) |
| 67 |
{ |
{ |
| 68 |
syslog << logfile::log_head << "Sockets init failed" << endl; |
syslog << logfile::log_head << "Sockets init failed" << endl; |
| 72 |
// Create the service object |
// Create the service object |
| 73 |
service innbbsd_srv; |
service innbbsd_srv; |
| 74 |
|
|
| 75 |
CString conf_file; |
innbbsd_srv.ctrld.load_conf(app_path + conf_file); |
|
conf_file = argv[0]; |
|
|
conf_file = conf_file.Left(conf_file.ReverseFind('\\')) + "\\innbbsd.conf"; |
|
|
|
|
|
innbbsd_srv.ctrld.load_conf(conf_file); |
|
| 76 |
|
|
| 77 |
//Standalone mode |
//Standalone mode |
| 78 |
if (argc == 2 && _stricmp(argv[1], "-s") == 0) |
if (argc == 2 && _stricmp(argv[1], "-s") == 0) |