diff options
author | Mauro Sardara <msardara+fdio@cisco.com> | 2018-02-26 13:22:04 +0100 |
---|---|---|
committer | Mauro Sardara <msardara+fdio@cisco.com> | 2018-02-26 13:50:17 +0100 |
commit | 1d4ce83ccc5143230fb1b8e8460073a51a0c9121 (patch) | |
tree | 919ad5c796b3a17d3e66f64017820e5d8ce7d742 /apps/producers/icnet_ping_server.cc | |
parent | 82a8803fc86680a149d43181f43b1ac4f69a359d (diff) |
Minor fixes for iping output.
Change-Id: Ia35e43dc62f2466128baefc119649fcff3e53858
Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
Diffstat (limited to 'apps/producers/icnet_ping_server.cc')
-rw-r--r-- | apps/producers/icnet_ping_server.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/apps/producers/icnet_ping_server.cc b/apps/producers/icnet_ping_server.cc index 57f0d88f..5ea084fc 100644 --- a/apps/producers/icnet_ping_server.cc +++ b/apps/producers/icnet_ping_server.cc @@ -45,25 +45,24 @@ class CallbackContainer { }; void help(char * program_name) { - std::cout << "usage: " << program_name <<" [options]" << std::endl; + std::cout << "usage: " << program_name <<" [options]" << " icn-name" << std::endl; std::cout << "PING options" << std::endl; std::cout << "-s <val> object content size (default 64B)" << std::endl; - std::cout << "-n <val> icn name (default ccnx:/webserver)" << std::endl; std::cout << "OUTPUT options" << std::endl; std::cout << "-H prints this message" << std::endl; } int main(int argc, char **argv) { - std::string name_prefix = "ccnx:/pingserver"; + std::string name_prefix = "ccnx:/ipingserver"; bool daemon = false; uint32_t object_size = 64; uint8_t ttl = 64; int opt; - while ((opt = getopt(argc, argv, "s:n:t:dH")) != -1) { + while ((opt = getopt(argc, argv, "s:t:dH")) != -1) { switch (opt) { case 's': - object_size = std::stoi(optarg); + object_size = uint32_t(std::stoul(optarg)); break; case 't': ttl = (uint8_t) std::stoi(optarg); @@ -78,8 +77,11 @@ int main(int argc, char **argv) { } } - if (argv[optind] != 0) { + if (argv[optind] != nullptr) { name_prefix = argv[optind]; + } else { + help(argv[0]); + exit(EXIT_FAILURE); } if (daemon) { |