From bf6acd5cc9e9407daad3e49f97fa9f09bd80b228 Mon Sep 17 00:00:00 2001 From: Junxiao Shi Date: Wed, 14 Sep 2016 03:57:57 +0000 Subject: [PATCH] tools: normalize nfdc exit codes refs #3749 Change-Id: I0c81dff095c170390f62de82badc0cca7b53392d --- docs/manpages/nfd-status.rst | 9 +++++++++ docs/manpages/nfdc.rst | 7 +++++++ tools/nfdc/legacy-nfdc.cpp | 6 +++--- tools/nfdc/main.cpp | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/manpages/nfd-status.rst b/docs/manpages/nfd-status.rst index f22f326c..a7ec0243 100644 --- a/docs/manpages/nfd-status.rst +++ b/docs/manpages/nfd-status.rst @@ -47,6 +47,15 @@ If no options are provided, all information is retrieved. If -x is provided, other options(-v, -c, etc.) are ignored, and all information is printed in XML format. +Exit Codes +---------- + +0: Success + +1: An unspecified error occurred + +2: Malformed command line + Examples -------- diff --git a/docs/manpages/nfdc.rst b/docs/manpages/nfdc.rst index d06b519b..c6fb3b89 100644 --- a/docs/manpages/nfdc.rst +++ b/docs/manpages/nfdc.rst @@ -181,7 +181,14 @@ Options Note that when ``faceId`` is the last Face associated with ``prefix`` FIB entry, the whole FIB entry will be removed. +Exit Codes +---------- +0: Success + +1: An unspecified error occurred + +2: Malformed command line Examples -------- diff --git a/tools/nfdc/legacy-nfdc.cpp b/tools/nfdc/legacy-nfdc.cpp index f5c4fa78..467789e0 100644 --- a/tools/nfdc/legacy-nfdc.cpp +++ b/tools/nfdc/legacy-nfdc.cpp @@ -357,7 +357,7 @@ legacyNfdcMain(ExecuteContext& ctx) catch (const po::error& e) { std::cerr << e.what() << std::endl; legacyNfdcUsage(); - return 1; + return 2; } if (wantUnsetChildInherit) { @@ -378,14 +378,14 @@ legacyNfdcMain(ExecuteContext& ctx) [] (const std::string& s) { return s.empty() || s[0] == '-'; })) { // unrecognized -option legacyNfdcUsage(); - return 1; + return 2; } p.m_commandLineArguments = unparsed; bool isOk = p.dispatch(subcommand); if (!isOk) { legacyNfdcUsage(); - return 1; + return 2; } ctx.face.processEvents(); return 0; diff --git a/tools/nfdc/main.cpp b/tools/nfdc/main.cpp index c5784077..bcd9da39 100644 --- a/tools/nfdc/main.cpp +++ b/tools/nfdc/main.cpp @@ -56,7 +56,7 @@ main(int argc, char** argv) } catch (const std::invalid_argument& e) { std::cerr << e.what() << std::endl; - return 1; + return 2; } try {