Add command line option --quiet.

This commit is contained in:
Arthur Britto
2012-12-01 17:56:27 -08:00
parent 51ee96e804
commit c2d6dc0ab7
3 changed files with 58 additions and 48 deletions

View File

@@ -1,3 +1,6 @@
//
// TODO: Check permissions on config file before using it.
//
#include "Config.h"
#include "utils.h"
@@ -48,7 +51,7 @@
Config theConfig;
void Config::setup(const std::string& strConf)
void Config::setup(const std::string& strConf, bool bQuiet)
{
boost::system::error_code ec;
@@ -58,6 +61,8 @@ void Config::setup(const std::string& strConf)
// that with "db" as the data directory.
//
QUIET = bQuiet;
if (!strConf.empty())
{
// --conf=<path> : everything is relative that file.
@@ -172,7 +177,8 @@ void Config::setup(const std::string& strConf)
void Config::load()
{
std::cout << "Loading: " << CONFIG_FILE << std::endl;
if (!QUIET)
std::cerr << "Loading: " << CONFIG_FILE << std::endl;
std::ifstream ifsConfig(CONFIG_FILE.c_str(), std::ios::in);