cam: fix printing of camera name

Since commit c8c546fe99 ("cam: options: Add option type handling
to options parser") introduced type handling for options the context the
option is read became important. When reading the camera option for
printing there is no explicit context to print it as a string and
instead the int context was chosen resulting in:

    $ cam --camera foo
    Camera 0 not found

While the expected output is:

    $ cam --camera foo
    Camera foo not found

Fix this by providing the correct context for the camera option when
printing it.

Fixes: c8c546fe99 ("cam: options: Add option type handling to options parser")
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund 2019-02-19 17:29:00 +01:00
parent dd14f1ec2c
commit 71e84c22da

View file

@ -230,7 +230,8 @@ int main(int argc, char **argv)
if (options.isSet(OptCamera)) {
camera = cm->get(options[OptCamera]);
if (!camera) {
std::cout << "Camera " << options[OptCamera]
std::cout << "Camera "
<< std::string(options[OptCamera])
<< " not found" << std::endl;
goto out;
}