fixed getopt exitcode with invalid parameters

This commit is contained in:
Blaise Tine 2024-09-07 03:42:46 -07:00
parent 2041a4ad4a
commit a75ed78bf2
26 changed files with 57 additions and 86 deletions

View file

@ -33,7 +33,7 @@ static void show_usage() {
static void parse_args(int argc, char **argv) {
int c;
while ((c = getopt(argc, argv, "n:k:h?")) != -1) {
while ((c = getopt(argc, argv, "n:k:h")) != -1) {
switch (c) {
case 'n':
count = atoi(optarg);
@ -42,10 +42,9 @@ static void parse_args(int argc, char **argv) {
kernel_file = optarg;
break;
case 'h':
case '?': {
show_usage();
exit(0);
} break;
break;
default:
show_usage();
exit(-1);