From 3c48817f42846edec7b4917107dea42e47bb9f2a Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 14 Nov 2008 10:31:14 +0300 Subject: [PATCH] [6822] Implement --version option for mangosd/realmd for output current binary version and exit. --- src/mangosd/Main.cpp | 25 +++++++++++++++++++++++++ src/mangosd/Master.cpp | 17 ----------------- src/realmd/Main.cpp | 13 ++++++++++--- src/shared/revision_nr.h | 2 +- 4 files changed, 36 insertions(+), 21 deletions(-) diff --git a/src/mangosd/Main.cpp b/src/mangosd/Main.cpp index 40706b19b..e116e7afa 100644 --- a/src/mangosd/Main.cpp +++ b/src/mangosd/Main.cpp @@ -26,6 +26,8 @@ #include "Log.h" #include "Master.h" #include "SystemConfig.h" +#include "revision.h" +#include "revision_nr.h" #ifdef WIN32 #include "ServiceWin32.h" @@ -51,6 +53,7 @@ uint32 realmID; ///< Id of the realm void usage(const char *prog) { sLog.outString("Usage: \n %s []\n" + " --version print version and exist\n\r" " -c config_file use config_file as configuration file\n\r" #ifdef WIN32 " Running as service functions:\n\r" @@ -86,6 +89,12 @@ extern int main(int argc, char **argv) cfg_file = argv[c]; } + if( strcmp(argv[c],"--version") == 0) + { + printf("%s\n", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID)); + return 0; + } + #ifdef WIN32 //////////// //Services// @@ -126,11 +135,27 @@ extern int main(int argc, char **argv) ++c; } + sLog.outString( "%s [world-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID) ); + sLog.outString( " to stop.\n\n" ); + + sLog.outTitle( "MM MM MM MM MMMMM MMMM MMMMM"); + sLog.outTitle( "MM MM MM MM MMM MMM MM MM MMM MMM"); + sLog.outTitle( "MMM MMM MMM MM MMM MMM MM MM MMM"); + sLog.outTitle( "MM M MM MMMM MM MMM MM MM MMM"); + sLog.outTitle( "MM M MM MMMMM MM MMMM MMM MM MM MMM"); + sLog.outTitle( "MM M MM M MMM MM MMM MMMMMMM MM MM MMM"); + sLog.outTitle( "MM MM MMM MM MM MM MMM MM MM MMM"); + sLog.outTitle( "MM MM MMMMMMM MM MM MMM MMM MM MM MMM MMM"); + sLog.outTitle( "MM MM MM MMM MM MM MMMMMM MMMM MMMMM"); + sLog.outTitle( " MM MMM http://getmangos.com"); + sLog.outTitle( " MMMMMM\n\n"); + if (!sConfig.SetSource(cfg_file)) { sLog.outError("Could not find configuration file %s.", cfg_file); return 1; } + sLog.outString("Using configuration file %s.", cfg_file); ///- and run the 'Master' diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp index cc8ab7381..4a01c10ab 100644 --- a/src/mangosd/Master.cpp +++ b/src/mangosd/Master.cpp @@ -32,8 +32,6 @@ #include "Timer.h" #include "Policies/SingletonImp.h" #include "SystemConfig.h" -#include "revision.h" -#include "revision_nr.h" #include "Config/ConfigEnv.h" #include "Database/DatabaseEnv.h" #include "CliRunnable.h" @@ -197,21 +195,6 @@ Master::~Master() /// Main function int Master::Run() { - sLog.outString( "%s [world-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID) ); - sLog.outString( " to stop.\n\n" ); - - sLog.outTitle( "MM MM MM MM MMMMM MMMM MMMMM"); - sLog.outTitle( "MM MM MM MM MMM MMM MM MM MMM MMM"); - sLog.outTitle( "MMM MMM MMM MM MMM MMM MM MM MMM"); - sLog.outTitle( "MM M MM MMMM MM MMM MM MM MMM"); - sLog.outTitle( "MM M MM MMMMM MM MMMM MMM MM MM MMM"); - sLog.outTitle( "MM M MM M MMM MM MMM MMMMMMM MM MM MMM"); - sLog.outTitle( "MM MM MMM MM MM MM MMM MM MM MMM"); - sLog.outTitle( "MM MM MMMMMMM MM MM MMM MMM MM MM MMM MMM"); - sLog.outTitle( "MM MM MM MMM MM MM MMMMMM MMMM MMMMM"); - sLog.outTitle( " MM MMM http://getmangos.com"); - sLog.outTitle( " MMMMMM\n\n"); - /// worldd PID file creation std::string pidfile = sConfig.GetStringDefault("PidFile", ""); if(!pidfile.empty()) diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 0d691cd8c..95efbcab4 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -60,6 +60,7 @@ DatabaseType dbRealmServer; ///< Accessor to the void usage(const char *prog) { sLog.outString("Usage: \n %s []\n" + " --version print version and exist\n\r" " -c config_file use config_file as configuration file\n\r" #ifdef WIN32 " Running as service functions:\n\r" @@ -90,6 +91,12 @@ extern int main(int argc, char **argv) cfg_file = argv[c]; } + if( strcmp(argv[c],"--version") == 0) + { + printf("%s\n", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID)); + return 0; + } + #ifdef WIN32 //////////// //Services// @@ -130,6 +137,9 @@ extern int main(int argc, char **argv) ++c; } + sLog.outString( "%s [realm-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID) ); + sLog.outString( " to stop.\n" ); + if (!sConfig.SetSource(cfg_file)) { sLog.outError("Could not find configuration file %s.", cfg_file); @@ -151,9 +161,6 @@ extern int main(int argc, char **argv) while (pause > clock()) {} } - sLog.outString( "%s [realm-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID) ); - sLog.outString( " to stop.\n" ); - /// realmd PID file creation std::string pidfile = sConfig.GetStringDefault("PidFile", ""); if(!pidfile.empty()) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f2aac579f..4b4e88e1f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "6821" + #define REVISION_NR "6822" #endif // __REVISION_NR_H__ -- 2.11.4.GIT