Configuration parser bug fixed.

This commit is contained in:
Erik Zandvliet 2013-04-24 10:25:34 +02:00
parent 4db81af990
commit a7de3bf08f
2 changed files with 2 additions and 2 deletions

View file

@ -167,7 +167,7 @@ void Util::Config::printHelp(std::ostream & output){
/// Parses commandline arguments. /// Parses commandline arguments.
/// Calls exit if an unknown option is encountered, printing a help message. /// Calls exit if an unknown option is encountered, printing a help message.
void Util::Config::parseArgs(int argc, char ** argv){ void Util::Config::parseArgs(int & argc, char ** & argv){
int opt = 0; int opt = 0;
std::string shortopts; std::string shortopts;
struct option * longOpts = (struct option*)calloc(long_count + 1, sizeof(struct option)); struct option * longOpts = (struct option*)calloc(long_count + 1, sizeof(struct option));

View file

@ -27,7 +27,7 @@ namespace Util {
Config(std::string cmd, std::string version); Config(std::string cmd, std::string version);
void addOption(std::string optname, JSON::Value option); void addOption(std::string optname, JSON::Value option);
void printHelp(std::ostream & output); void printHelp(std::ostream & output);
void parseArgs(int argc, char ** argv); void parseArgs(int & argc, char ** & argv);
JSON::Value & getOption(std::string optname, bool asArray = false); JSON::Value & getOption(std::string optname, bool asArray = false);
std::string getString(std::string optname); std::string getString(std::string optname);
long long int getInteger(std::string optname); long long int getInteger(std::string optname);