diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-02-20 02:33:29 +0100 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-02-25 23:14:39 +0100 |
commit | 374c102073bf8712dc5433f778ca39f85bb97f9c (patch) | |
tree | 5bbe6f16b9d4815bfb350c0938a8dc8f0a62cb6c /src/cam/main.cpp | |
parent | 71e84c22dafbc45836c971f2154463ccf20077fc (diff) |
cam: Improve when usage information is printed
Running the cam tool without any options results in the tool to exit
with EXIT_FAILURE but no usage being printed, this is confusing. Improve
this by also printing the usage text.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/cam/main.cpp')
-rw-r--r-- | src/cam/main.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/cam/main.cpp b/src/cam/main.cpp index ddb416f6..4c2df583 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -67,12 +67,9 @@ static int parseOptions(int argc, char *argv[]) parser.addOption(OptList, OptionNone, "List all cameras", "list"); options = parser.parse(argc, argv); - if (!options.valid()) - return -EINVAL; - - if (argc == 1 || options.isSet(OptHelp)) { + if (!options.valid() || options.isSet(OptHelp)) { parser.usage(); - return 1; + return !options.valid() ? -EINVAL : -EINTR; } return 0; @@ -204,7 +201,7 @@ int main(int argc, char **argv) ret = parseOptions(argc, argv); if (ret < 0) - return EXIT_FAILURE; + return ret == -EINTR ? 0 : EXIT_FAILURE; CameraManager *cm = CameraManager::instance(); |