[11751] Implement option for set ahbot config file in mangosd command line

"-a configfilename" or "--ahbot configfilename" can be used for this

This possibility can be useful if normal mangosd.conf path also set by -c
option for example.
This commit is contained in:
VladimirMangos 2011-07-24 08:23:10 +04:00
parent b26a969e0d
commit f07a3232d4
4 changed files with 19 additions and 8 deletions

View file

@ -27,6 +27,7 @@
#include "Log.h"
#include "Master.h"
#include "SystemConfig.h"
#include "AuctionHouseBot/AuctionHouseBot.h"
#include "revision.h"
#include "revision_nr.h"
#include <openssl/opensslv.h>
@ -62,6 +63,7 @@ void usage(const char *prog)
sLog.outString("Usage: \n %s [<options>]\n"
" -v, --version print version and exist\n\r"
" -c config_file use config_file as configuration file\n\r"
" -a, --ahbot config_file use config_file as ahbot configuration file\n\r"
#ifdef WIN32
" Running as service functions:\n\r"
" -s run run as service\n\r"
@ -82,10 +84,11 @@ extern int main(int argc, char **argv)
char const* cfg_file = _MANGOSD_CONFIG;
char const *options = ":c:s:";
char const *options = ":a:c:s:";
ACE_Get_Opt cmd_opts(argc, argv, options);
cmd_opts.long_option("version", 'v');
cmd_opts.long_option("version", 'v', ACE_Get_Opt::NO_ARG);
cmd_opts.long_option("ahbot", 'a', ACE_Get_Opt::ARG_REQUIRED);
char serviceDaemonMode = '\0';
@ -94,6 +97,9 @@ extern int main(int argc, char **argv)
{
switch (option)
{
case 'a':
sAuctionBotConfig.SetConfigFileName(cmd_opts.opt_arg());
break;
case 'c':
cfg_file = cmd_opts.opt_arg();
break;