tools: Handling case of no command line options in ``nfdc``
Change-Id: Iab7d3a6f0b5f034a2a50a546f1b92814b23c7d5d
diff --git a/tools/nfdc.cpp b/tools/nfdc.cpp
index 1ad54af..8dc94f2 100644
--- a/tools/nfdc.cpp
+++ b/tools/nfdc.cpp
@@ -235,7 +235,7 @@
{
ndn::Face face;
nfdc::Controller p(face);
-
+
p.m_programName = argv[0];
int opt;
while ((opt = getopt(argc, argv, "h")) != -1) {
@@ -249,6 +249,12 @@
return 1;
}
}
+
+ if (argc == optind) {
+ usage(p.m_programName);
+ return 1;
+ }
+
try {
bool hasSucceeded = p.dispatch(argv[optind],
const_cast<const char**>(argv + optind + 1),