Skip to content

Commit

Permalink
Fix error message for wrong trigger
Browse files Browse the repository at this point in the history
Previously the program exited with exit code 0 and no warning if you
entered an invalid trigger not being "left", "right", or "both". Now
this issue is fixed.
  • Loading branch information
Chasarr authored and nowrep committed Jun 22, 2024
1 parent ed9df10 commit 8d82fa9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,10 @@ int main(int argc, char *argv[])
fprintf(stderr, "Invalid arguments\n");
return 2;
}
if (strcmp(argv[2], "left") && strcmp(argv[2], "right") && strcmp(argv[2], "both")) {
fprintf(stderr, "Invalid argument: TRIGGER must be either \"left\", \"right\" or \"both\"\n");
return 2;
}
if (!strcmp(argv[3], "off")) {
return command_trigger_off(&ds, argv[2]);
} else if (!strcmp(argv[3], "feedback")) {
Expand Down

0 comments on commit 8d82fa9

Please sign in to comment.