From 0fd6e738d9380ae0460bcbe6926c259bd98b4086 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Wed, 26 Mar 2025 22:15:43 -0400 Subject: [PATCH] force elements to be lowercase --- src/command.c | 5 ----- src/main.c | 7 +++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/command.c b/src/command.c index 1375bdd..321dc7a 100644 --- a/src/command.c +++ b/src/command.c @@ -1,5 +1,4 @@ #include "map.h" -#include #include #include #include @@ -243,10 +242,6 @@ int get_command(char *command, char *command_re, char **sort_tmp) { command[cl - 1] = '\0'; - for (int i = 0; i < cl - 1; i++) { - command[i] = tolower(command[i]); - } - sort_tmp[0] = command; int combos = 0; for (int i = 1; i < MAX_COMBO_LENGTH; i++) { diff --git a/src/main.c b/src/main.c index 11deef3..7809deb 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,6 @@ #include "command.h" #include "loader.h" +#include #include #include #include @@ -58,6 +59,12 @@ int main(int argc, char *argv[]) { printf("\n"); fgets(command, MAX_BUF_LENGTH - 1, stdin); + int cl = strlen(command); + + for (int i = 0; i < cl - 1; i++) { + command[i] = tolower(command[i]); + } + if (wasCombination && suggest_command(command, command_re, polls, name)) { wasCombination = 0; continue;