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

@ -147,16 +147,15 @@ static void show_usage() {
static void parse_args(int argc, char **argv) {
int c;
while ((c = getopt(argc, argv, "n:h?")) != -1) {
while ((c = getopt(argc, argv, "n:h")) != -1) {
switch (c) {
case 'n':
size = atoi(optarg);
break;
case 'h':
case '?': {
show_usage();
exit(0);
} break;
break;
default:
show_usage();
exit(-1);