mirror of
https://github.com/AuxXxilium/eudev.git
synced 2025-02-20 08:37:55 +07:00
v4l_id: use standard option parsing loop
Not terribly important, but the loop wasn't an actual loop, making coverity unhappy. CID #1261725. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
This commit is contained in:
parent
a45a9a1c32
commit
a46b4ff7cc
@ -40,29 +40,28 @@ int main(int argc, char *argv[]) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
char *device;
|
||||
struct v4l2_capability v2cap;
|
||||
int c;
|
||||
|
||||
for (;;) {
|
||||
int option;
|
||||
while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0)
|
||||
|
||||
option = getopt_long(argc, argv, "h", options, NULL);
|
||||
if (option == -1)
|
||||
break;
|
||||
|
||||
switch (option) {
|
||||
switch (c) {
|
||||
case 'h':
|
||||
printf("%s [-h,--help] <device file>\n\n"
|
||||
"Video4Linux device identification.\n\n"
|
||||
" -h Print this message\n"
|
||||
, program_invocation_short_name);
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
device = argv[optind];
|
||||
case '?':
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
}
|
||||
|
||||
device = argv[optind];
|
||||
if (device == NULL)
|
||||
return 2;
|
||||
|
||||
fd = open(device, O_RDONLY);
|
||||
if (fd < 0)
|
||||
return 3;
|
||||
|
Loading…
Reference in New Issue
Block a user