diff --git a/src/init.cpp b/src/init.cpp index 5c4cf267..95bf627f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -41,9 +41,9 @@ #include //////////////////////////////////////////////////////////////////////////////// -bool lightweightVersionCheck (const std::vector & args) +bool lightweightVersionCheck (int argc, const char** argv) { - if (args.size () == 2 && args[1] == "--version") + if (argc == 2 && std::string (argv[1]) == "--version") { std::cout << VERSION << "\n"; return true; diff --git a/src/timew.cpp b/src/timew.cpp index 338b3b93..ca13347d 100644 --- a/src/timew.cpp +++ b/src/timew.cpp @@ -38,6 +38,11 @@ //////////////////////////////////////////////////////////////////////////////// int main (int argc, const char** argv) { + // Lightweight version checking that doesn't require initialization or I/O. + int status = 0; + if (lightweightVersionCheck (argc, argv)) + return status; + // The log is needed early, in order to capture as much as possible, but will // only be given a file name once the rules are loaded. The log therefore // buffers the messages until it has a file name to write to. @@ -49,11 +54,6 @@ int main (int argc, const char** argv) for (int i = 0; i < argc; i++) args.push_back (argv[i]); - // Lightweight version checking that doesn't require initialization or I/O. - int status = 0; - if (lightweightVersionCheck (args)) - return status; - try { // Prepare the database, but do not read data. diff --git a/src/timew.h b/src/timew.h index db06f84e..5e4b2ef3 100644 --- a/src/timew.h +++ b/src/timew.h @@ -35,7 +35,7 @@ #include // init.cpp -bool lightweightVersionCheck (const std::vector &); +bool lightweightVersionCheck (int, const char**); void initializeDataAndRules (Database&, Rules&, Log&); void initializeExtensions (Rules&, Extensions&, Log&); int dispatchCommand (const std::vector &, Database&, Rules&, Extensions&, Log&);