From a6451e4904c81a692241ac31945a1c986c9b7a5e Mon Sep 17 00:00:00 2001 From: biglyderv Date: Fri, 28 Mar 2025 01:36:28 -0400 Subject: [PATCH] don't continue on empty strings --- src/main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index b4c6f9c..78a67b4 100644 --- a/src/main.c +++ b/src/main.c @@ -48,14 +48,25 @@ int main(int argc, char *argv[]) { init_tables(elements, inv, polls, 1); printf("%s, welcome to Elemental on Command Line!\n", name); + int newline = 1; while (1) { // todo: separate into functions - printf("\n"); + if (newline) { + + printf("\n"); + } fgets(command, MAX_BUF_LENGTH - 1, stdin); int cl = strlen(command); + if (cl < 2) { + newline = 0; + continue; + } else { + newline = 1; + } + for (int i = 0; i < cl - 1; i++) { command[i] = tolower(command[i]); }