kbdcontrol -h prints two error messages.

We loop through getopt(3) twice. Once for -P args and once for the
rest. Catch '?' and print usage when that happens.
This commit is contained in:
Warner Losh 2019-06-24 21:05:14 +00:00
parent 893caf588a
commit 73701bbe9d

View File

@ -1220,9 +1220,12 @@ main(int argc, char **argv)
int opt;
/* Collect any -P arguments, regardless of where they appear. */
while ((opt = getopt(argc, argv, optstring)) != -1)
while ((opt = getopt(argc, argv, optstring)) != -1) {
if (opt == 'P')
add_keymap_path(optarg);
if (opt == '?')
usage();
}
optind = optreset = 1;
while ((opt = getopt(argc, argv, optstring)) != -1)