Timew: Combined argc/argv into args

- Modified lightweightVersionCheck.
This commit is contained in:
Paul Beckingham 2016-03-17 16:39:21 -04:00
parent a21206bfb3
commit ee351d33e3
3 changed files with 9 additions and 4 deletions

View file

@ -42,9 +42,9 @@
#include <iostream> #include <iostream>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool lightweightVersionCheck (int argc, const char** argv) bool lightweightVersionCheck (const std::vector <std::string>& args)
{ {
if (argc == 2 && ! std::strcmp (argv[1], "--version")) if (args.size () == 2 && args[1] == "--version")
{ {
std::cout << VERSION << "\n"; std::cout << VERSION << "\n";
return true; return true;

View file

@ -48,9 +48,14 @@ int main (int argc, const char** argv)
// buffers the messages until it has a file name to write to. // buffers the messages until it has a file name to write to.
Log log; Log log;
// Make a vector of args, instead of argc/argv.
std::vector <std::string> args;
for (int i = 0; i < argc; i++)
args.push_back (argv[i]);
// Lightweight version checking that doesn't require initialization or I/O. // Lightweight version checking that doesn't require initialization or I/O.
int status = 0; int status = 0;
if (lightweightVersionCheck (argc, argv)) if (lightweightVersionCheck (args))
return status; return status;
try try

View file

@ -34,7 +34,7 @@
#include <Log.h> #include <Log.h>
// init.cpp // init.cpp
bool lightweightVersionCheck (int, const char**); bool lightweightVersionCheck (const std::vector <std::string>&);
void initializeData (Configuration&, Database&, Log&); void initializeData (Configuration&, Database&, Log&);
void initializeRules (Configuration&, Rules&, Log&); void initializeRules (Configuration&, Rules&, Log&);
void initializeExtensions (Configuration&, Extensions&, Log&); void initializeExtensions (Configuration&, Extensions&, Log&);