pingserver: change the short form of --freshness to -f
-x is still accepted but will print a deprecation warning
Change-Id: Ibc2e9750006a450c85d19c432ec1a02416cdc174
diff --git a/tools/ping/README.md b/tools/ping/README.md
index 8df5adc..0bf3150 100644
--- a/tools/ping/README.md
+++ b/tools/ping/README.md
@@ -11,29 +11,29 @@
## Using the Client
The client can be invoked by calling **ndnping** with a name to ping. For example, to ping
-`ndn:/edu/arizona`, one would execute::
+`/edu/arizona`, one would execute:
- ndnping ndn:/edu/arizona
+ ndnping /edu/arizona
There are also a variety of options to control the behavior of the ping client. For example, to
-send only four pings to `ndn:/edu/arizona`, displaying a timestamp with each received Data or
-timeout, type::
+send only four pings to `/edu/arizona`, displaying a timestamp with each received Data or
+timeout, type:
- ndnping -c 4 -t ndn:/edu/arizona
+ ndnping -c 4 -t /edu/arizona
A list of the available options can be found with `man ndnping`.
## Using the Server
The server can be invoked by calling **ndnpingserver** with a name to listen for pings to. For
-example, to listen for pings to `ndn:/edu/arizona`, one would execute::
+example, to listen for pings to `/edu/arizona`, one would execute:
- ndnpingserver ndn:/edu/arizona
+ ndnpingserver /edu/arizona
There are also a variety of options to control the behavior of the ping server. For example, to
-satisfy only 4 ping requests before exiting, execute the following::
+satisfy only 4 ping requests before exiting, execute the following:
- ndnpingserver -p 4 ndn:/edu/arizona
+ ndnpingserver -p 4 /edu/arizona
A list of the available options can be found with `man ndnpingserver`.
diff --git a/tools/ping/server/main.cpp b/tools/ping/server/main.cpp
index 9aa7261..dcce849 100644
--- a/tools/ping/server/main.cpp
+++ b/tools/ping/server/main.cpp
@@ -105,10 +105,10 @@
po::options_description visibleDesc("Options");
visibleDesc.add_options()
("help,h", "print this help message and exit")
- ("freshness,x", po::value<time::milliseconds::rep>()->default_value(options.freshnessPeriod.count()),
+ ("freshness,f", po::value<time::milliseconds::rep>()->default_value(options.freshnessPeriod.count()),
"FreshnessPeriod of the ping response, in milliseconds")
("satisfy,p", po::value(&nMaxPings)->default_value(nMaxPings),
- "maximum number of pings to be satisfied (0=infinite)")
+ "maximum number of pings to satisfy (0 = no limit)")
("size,s", po::value(&payloadSize)->default_value(payloadSize),
"size of response payload")
("timestamp,t", po::bool_switch(&options.wantTimestamp),
@@ -122,11 +122,16 @@
hiddenDesc.add_options()
("prefix", po::value<std::string>(&prefix));
- po::positional_options_description posDesc;
- posDesc.add("prefix", -1);
+ po::options_description deprecatedDesc;
+ deprecatedDesc.add_options()
+ ("_deprecated_freshness_,x", po::value<time::milliseconds::rep>())
+ ;
po::options_description optDesc;
- optDesc.add(visibleDesc).add(hiddenDesc);
+ optDesc.add(visibleDesc).add(hiddenDesc).add(deprecatedDesc);
+
+ po::positional_options_description posDesc;
+ posDesc.add("prefix", -1);
po::variables_map vm;
try {
@@ -144,6 +149,11 @@
return 2;
}
+ if (vm.count("_deprecated_freshness_") > 0) {
+ std::cerr << "WARNING: short option '-x' is deprecated and will be removed in the near "
+ "future. Please use '-f' or the long form '--freshness'." << std::endl;
+ }
+
if (vm.count("help") > 0) {
usage(std::cout, argv[0], visibleDesc);
return 0;
@@ -162,6 +172,9 @@
options.prefix = prefix;
options.freshnessPeriod = time::milliseconds(vm["freshness"].as<time::milliseconds::rep>());
+ if (vm.count("_deprecated_freshness_") > 0) {
+ options.freshnessPeriod = time::milliseconds(vm["_deprecated_freshness_"].as<time::milliseconds::rep>());
+ }
if (options.freshnessPeriod < 0_ms) {
std::cerr << "ERROR: FreshnessPeriod cannot be negative" << std::endl;
return 2;