mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-16 17:05:08 +03:00
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>
This commit is contained in:
parent
71e84c22da
commit
374c102073
1 changed files with 3 additions and 6 deletions
|
@ -67,12 +67,9 @@ static int parseOptions(int argc, char *argv[])
|
||||||
parser.addOption(OptList, OptionNone, "List all cameras", "list");
|
parser.addOption(OptList, OptionNone, "List all cameras", "list");
|
||||||
|
|
||||||
options = parser.parse(argc, argv);
|
options = parser.parse(argc, argv);
|
||||||
if (!options.valid())
|
if (!options.valid() || options.isSet(OptHelp)) {
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (argc == 1 || options.isSet(OptHelp)) {
|
|
||||||
parser.usage();
|
parser.usage();
|
||||||
return 1;
|
return !options.valid() ? -EINVAL : -EINTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -204,7 +201,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
ret = parseOptions(argc, argv);
|
ret = parseOptions(argc, argv);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return EXIT_FAILURE;
|
return ret == -EINTR ? 0 : EXIT_FAILURE;
|
||||||
|
|
||||||
CameraManager *cm = CameraManager::instance();
|
CameraManager *cm = CameraManager::instance();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue