[dss-commits] r8754 - dss/trunk
dss-commits at forum.digitalstrom.org
dss-commits at forum.digitalstrom.org
Wed Sep 9 13:10:13 CEST 2009
Author: jwinkelmann
Date: 2009-09-09 13:10:13 +0200 (Wed, 09 Sep 2009)
New Revision: 8754
Modified:
dss/trunk/main.cpp
Log:
introduce --version, -v option to print version and exit
Modified: dss/trunk/main.cpp
===================================================================
--- dss/trunk/main.cpp 2009-09-09 11:10:11 UTC (rev 8753)
+++ dss/trunk/main.cpp 2009-09-09 11:10:13 UTC (rev 8754)
@@ -64,13 +64,7 @@
}
} // parse_prop
-int main (int argc, char* argv[]) {
-
- if (!setlocale(LC_CTYPE, "")) {
- cerr << "Can't set the specified locale! Check LANG, LC_CTYPE, LC_ALL." << endl;
- return 1;
- }
-
+void printVersion() {
#ifdef RELEASE_BUILD
cout << "DSS v" << DSS_VERSION << " released at " << DSS_BUILD_DATE << endl;
#else
@@ -82,7 +76,15 @@
cout << " build host: " << DSS_BUILD_HOST << "\n";
cout << endl;
#endif
+}
+int main (int argc, char* argv[]) {
+
+ if (!setlocale(LC_CTYPE, "")) {
+ cerr << "Can't set the specified locale! Check LANG, LC_CTYPE, LC_ALL." << endl;
+ return 1;
+ }
+
// make sure timezone gets set
tzset();
@@ -123,6 +125,7 @@
("sniff,s", po::value<string>(), "start the ds485 sniffer")
#endif
("prop", po::value<vector<string> >(), "sets a property")
+ ("version,v", "print version information and exit")
;
po::variables_map vm;
@@ -135,6 +138,11 @@
return 1;
}
+ if (vm.count("version")) {
+ printVersion();
+ return 1;
+ }
+
bool runTests = true;
if(vm.count("dont-runtests")) {
runTests = !vm["dont-runtests"].as<bool>();
@@ -177,6 +185,12 @@
} else {
if(!quitAfterTests) {
// start DSS
+
+ // for now, we always print out the version to make the logs
+ // more expressive; this should go away in the future
+ printVersion();
+
+
dss::DSS::getInstance()->initialize(properties);
dss::DSS::getInstance()->run();
}
More information about the dss-commits
mailing list