[libcamera-devel] [PATCH v2 4/4] cam: Improve when usage information is printed
Niklas Söderlund
niklas.soderlund at ragnatech.se
Sun Feb 24 18:14:07 CET 2019
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 at ragnatech.se>
---
src/cam/main.cpp | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/cam/main.cpp b/src/cam/main.cpp
index 522d2f0d3373dc25..90859fe04abfb944 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;
@@ -207,7 +204,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();
--
2.20.1
More information about the libcamera-devel
mailing list