build+core: Add printing of version number in daemons and tools
This commit also changes how version number is handled. Version is now
fully controlled from top-level wscript. In addition to that, a new
NFD_VERSION_BUILD_STRING macro is set to include more detailed
information, including commit ID (e.g., "0.1.0-rc1-1-g5c86570").
Change-Id: I448eb627e0c42dc814de1107cf7bb0dc94fa2a89
Refs: #1575
diff --git a/tools/ndn-tlv-poke.cpp b/tools/ndn-tlv-poke.cpp
index 5ff5a50..f90b735 100644
--- a/tools/ndn-tlv-poke.cpp
+++ b/tools/ndn-tlv-poke.cpp
@@ -25,6 +25,8 @@
* @author Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
*/
+#include "version.hpp"
+
#include <boost/utility.hpp>
#include <ndn-cxx/face.hpp>
@@ -63,7 +65,9 @@
" [-F] - set FinalBlockId to the last component of Name\n"
" [-x] - set FreshnessPeriod in time::milliseconds\n"
" [-w timeout] - set Timeout in time::milliseconds\n"
- " [-h] - print help and exit\n\n";
+ " [-h] - print help and exit\n"
+ " [-V] - print version and exit\n"
+ "\n";
exit(1);
}
@@ -228,35 +232,37 @@
{
int option;
ndntlvpoke::NdnTlvPoke ndnTlvPoke(argv[0]);
- while ((option = getopt(argc, argv, "hfDi:Fx:w:")) != -1)
- {
- switch (option) {
- case 'h':
- ndnTlvPoke.usage();
- break;
- case 'f':
- ndnTlvPoke.setForceData();
- break;
- case 'D':
- ndnTlvPoke.setUseDigestSha256();
- break;
- case 'i':
- ndnTlvPoke.setIdentityName(optarg);
- break;
- case 'F':
- ndnTlvPoke.setLastAsFinalBlockId();
- break;
- case 'x':
- ndnTlvPoke.setFreshnessPeriod(atoi(optarg));
- break;
- case 'w':
- ndnTlvPoke.setTimeout(atoi(optarg));
- break;
- default:
- ndnTlvPoke.usage();
- break;
- }
+ while ((option = getopt(argc, argv, "hfDi:Fx:w:V")) != -1) {
+ switch (option) {
+ case 'h':
+ ndnTlvPoke.usage();
+ break;
+ case 'f':
+ ndnTlvPoke.setForceData();
+ break;
+ case 'D':
+ ndnTlvPoke.setUseDigestSha256();
+ break;
+ case 'i':
+ ndnTlvPoke.setIdentityName(optarg);
+ break;
+ case 'F':
+ ndnTlvPoke.setLastAsFinalBlockId();
+ break;
+ case 'x':
+ ndnTlvPoke.setFreshnessPeriod(atoi(optarg));
+ break;
+ case 'w':
+ ndnTlvPoke.setTimeout(atoi(optarg));
+ break;
+ case 'V':
+ std::cout << NFD_VERSION_BUILD_STRING << std::endl;
+ return 0;
+ default:
+ ndnTlvPoke.usage();
+ break;
}
+ }
argc -= optind;
argv += optind;