[6822] Implement --version option for mangosd/realmd for output current binary version and exit.

This commit is contained in:
VladimirMangos 2008-11-14 10:31:14 +03:00
parent 02ec0d5233
commit 2bf6345beb
4 changed files with 36 additions and 21 deletions

View file

@ -60,6 +60,7 @@ DatabaseType dbRealmServer; ///< Accessor to the
void usage(const char *prog)
{
sLog.outString("Usage: \n %s [<options>]\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( "<Ctrl-C> 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( "<Ctrl-C> to stop.\n" );
/// realmd PID file creation
std::string pidfile = sConfig.GetStringDefault("PidFile", "");
if(!pidfile.empty())