From 177f9025e04ef1dea3aeeb4ca0e1e2fecfd6c2ca Mon Sep 17 00:00:00 2001 From: biglyderv Date: Sat, 29 Mar 2025 02:51:38 -0400 Subject: [PATCH] clean up the poll command output --- src/command.c | 9 +++++++-- src/main.c | 2 +- src/main.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/command.c b/src/command.c index ac5e0a1..7b60c8f 100644 --- a/src/command.c +++ b/src/command.c @@ -61,11 +61,16 @@ int inv_handler(const void *key, size_t size, uintptr_t val, void *usr) { char *val2 = (char *)val; if (i->is_poll) { + char *key3 = calloc(strlen(key2)+1,sizeof(char)); + memcpy(key3,key2,strstr(key2,"_") - key2); + if (val2[strlen(val2) - 1] == '\n') { - printf("- %s suggested %s", key2, val2); + printf("- %s suggested %s", key3, val2); } else { - printf("- %s suggested %s\n", key2, val2); + printf("- %s suggested %s\n", key3, val2); } + + free(key3); return 1; } diff --git a/src/main.c b/src/main.c index e7b52b3..3d94128 100644 --- a/src/main.c +++ b/src/main.c @@ -8,7 +8,7 @@ #include "main.h" -// todo: polls, help commands, spacing in combos +// todo: polls, help commands, spacing in combos, clean init_tables void init_tables(hashmap *elements, hashmap *inv, hashmap *polls, int do_inv) { load_elements(elements, "../elem_data/" combo_file, 0); diff --git a/src/main.h b/src/main.h index 199f669..7761ac3 100644 --- a/src/main.h +++ b/src/main.h @@ -3,6 +3,7 @@ #define combo_file "combos.txt" #define poll_file "polls.txt" #define polls_lock_file "polls_lock.txt" +#define lb_file "lb.txt" #define MAX_BUF_LENGTH 1024 #define MAX_COMBO_LENGTH 1024