From c69b708d274394af5556f418ec4e5bab5e89da25 Mon Sep 17 00:00:00 2001 From: Carl Philipp Klemm <philipp@uvos.xyz> Date: Tue, 17 Oct 2023 13:33:18 +0200 Subject: [PATCH] dont continue with wrong number of commands --- main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.c b/main.c index ef3a92a..acc08ac 100644 --- a/main.c +++ b/main.c @@ -110,8 +110,11 @@ static int process_commands(char** commands, size_t command_count, struct coince else if(strcmp(commands[0], "set") == 0) { if(command_count < 3) + { printf("Usage %s %s [HEATER] [TEMPERATURE]\n", name, commands[0]); + } + int id = convert_string_to_heater_id(commands[1]); if(id < 0) return 1; @@ -125,7 +128,10 @@ static int process_commands(char** commands, size_t command_count, struct coince else if(strcmp(commands[0], "ramp") == 0) { if(command_count < 4) + { printf("Usage %s %s [HEATER] [TEMPERATURE] [SECONDS]\n", name, commands[0]); + return 1; + } int id = convert_string_to_heater_id(commands[1]); if(id < 0) -- GitLab