diff options
author | David Wagner <david.wagner@intel.com> | 2014-06-25 13:27:45 +0200 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-06-25 13:27:45 +0200 |
commit | c07d55bb3c78872c48ee28ad56a8470b9a7f6f2d (patch) | |
tree | 8fafb8b6c563f26852c3827eb15e5e4dc4209a01 /test/test-platform | |
parent | 142e27e17a001f862e55a689f1d22231cc8916c6 (diff) | |
parent | 9cc5b2b7d242f4e94f87a393d7e851040ee88990 (diff) | |
download | external_parameter-framework-c07d55bb3c78872c48ee28ad56a8470b9a7f6f2d.zip external_parameter-framework-c07d55bb3c78872c48ee28ad56a8470b9a7f6f2d.tar.gz external_parameter-framework-c07d55bb3c78872c48ee28ad56a8470b9a7f6f2d.tar.bz2 |
Merge pull request #4 from kir0gawa/help-messages
Help messages
Diffstat (limited to 'test/test-platform')
-rw-r--r-- | test/test-platform/main.cpp | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/test/test-platform/main.cpp b/test/test-platform/main.cpp index 129224a..a3f50be 100644 --- a/test/test-platform/main.cpp +++ b/test/test-platform/main.cpp @@ -153,12 +153,27 @@ static bool startDaemonTestPlatform(const char *filePath, int portNumber, string } } -static void usage() +static void showUsage() { - cerr << "Invalid arguments: test-platform [-d] <file path> [port number, default " + cerr << "test-platform [-dh] <file path> [port number, default " << iDefaultPortNumber << "]" << endl; } +static void showInvalidUsage() +{ + cerr << "Invalid arguments: "; + showUsage(); +} + +static void showHelp() +{ + showUsage(); + cerr << "<file path> must be a valid .xml file, oftenly ParameterFrameworkConfiguration.xml" << endl; + cerr << "Arguments:" << endl + << " -d starts as a deamon" << endl + << " -h display this help and exit" << endl; +} + int main(int argc, char *argv[]) { // Option found by call to getopt() @@ -174,15 +189,17 @@ int main(int argc, char *argv[]) int indexFilePath = 1; // Handle the -d option - while ((opt = getopt(argc, argv, "d")) != -1) { + while ((opt = getopt(argc, argv, "dh")) != -1) { switch (opt) { case 'd': isDaemon = true; indexFilePath = 2; break; - + case 'h': + showHelp(); + return 0; default: - usage(); + showInvalidUsage(); return -1; } } @@ -190,7 +207,7 @@ int main(int argc, char *argv[]) // Check the number of arguments if ((argc < indexFilePath + 1) || (argc > indexFilePath + 2)) { - usage(); + showInvalidUsage(); return -1; } |