From 3f15fecf9bce99e11b2cf1fd3224c1cc78036e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlie=20Ringstr=C3=B6m?= Date: Sat, 22 Jun 2024 17:11:34 +0200 Subject: [PATCH] Fix error message for wrong trigger 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. --- main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.c b/main.c index 18020c1..2112d8c 100644 --- a/main.c +++ b/main.c @@ -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")) {