--- innwebd/innbbsd.cpp 2004/07/03 05:52:38 1.2 +++ innwebd/innbbsd.cpp 2008/04/11 17:14:49 1.7 @@ -1,14 +1,10 @@ /*******************************************************/ /* */ -/* LeafOK Innd */ -/* Copyright (C) LeafOK.com, 2003-2004 */ +/* LeafOK Innbbsd */ /* */ -/* Programmed by Leaf */ -/* E-mail:leaf@leafok.com QQ:6049044 */ +/* Copyright (C) LeafOK.com, 2003-2008 */ /* */ -/* http://bbs.leafok.com */ -/* http://bbs.leafok.net */ -/* http://bbs.fenglin.info */ +/* http://www.leafok.com */ /* */ /*******************************************************/ @@ -20,6 +16,7 @@ #include ".\innbbsd.h" #include ".\service.h" #include ".\bbs_fun.h" +#include ".\App_common.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -62,6 +59,12 @@ int _tmain(int argc, TCHAR* argv[], TCHA syslog.open(app_path + log_file, ios_base::out | ios_base::app); + // Report program information + syslog << "********************" << endl; + syslog << App_common::GetVersion() << endl; + syslog << App_common::Copyright << endl; + syslog << logfile::log_head << "Starting up..." << endl; + // Initialize sockets if(!AfxSocketInit()) { @@ -77,23 +80,50 @@ int _tmain(int argc, TCHAR* argv[], TCHA //Standalone mode if (argc == 2 && _stricmp(argv[1], "-s") == 0) { - innbbsd_srv.ctrld.begin(); - innbbsd_srv.ctrld.StartupChild(); + innbbsd_srv.ctrld.InitThreadPool(); + + if (innbbsd_srv.ctrld.begin() == 0) + { + syslog << logfile::log_head << "Begin CONTROLD ... OK" << endl; - while (innbbsd_srv.ctrld.IsRunning()) + innbbsd_srv.ctrld.StartupChild(); + + while (innbbsd_srv.ctrld.IsRunning()) + { + Sleep(100); + } + + innbbsd_srv.ctrld.ShutdownChild(); + } + else { - Sleep(100); - } + syslog << logfile::log_head << "Begin CONTROLD ... Failed" << endl; + } - innbbsd_srv.ctrld.bbsd.end(); - innbbsd_srv.ctrld.innd.end(); - innbbsd_srv.ctrld.outd.end(); - innbbsd_srv.ctrld.end(); + if (innbbsd_srv.ctrld.end() == 0) + { + syslog << logfile::log_head << "End CONTROLD ... OK" << endl; + } + else + { + syslog << logfile::log_head << "End CONTROLD ... Failed" << endl; + } + + innbbsd_srv.ctrld.CleanupThreadPool(); + + ExitProcess(0); return 0; } - // Parse for standard arguments (install, uninstall, version etc.) + // Display version infomation + if (argc == 2 && _stricmp(argv[1], "-c") == 0) + { + cout << App_common::GetVersion() << endl; + cout << App_common::Copyright << endl; + } + + // Parse for standard arguments (install, uninstall, version etc.) if (!innbbsd_srv.ParseStandardArgs(argc, argv)) { //DebugBreak(); innbbsd_srv.StartService();