clean up the poll command output
This commit is contained in:
parent
4b3b6c9111
commit
177f9025e0
3 changed files with 9 additions and 3 deletions
|
@ -61,11 +61,16 @@ int inv_handler(const void *key, size_t size, uintptr_t val, void *usr) {
|
||||||
char *val2 = (char *)val;
|
char *val2 = (char *)val;
|
||||||
|
|
||||||
if (i->is_poll) {
|
if (i->is_poll) {
|
||||||
|
char *key3 = calloc(strlen(key2)+1,sizeof(char));
|
||||||
|
memcpy(key3,key2,strstr(key2,"_") - key2);
|
||||||
|
|
||||||
if (val2[strlen(val2) - 1] == '\n') {
|
if (val2[strlen(val2) - 1] == '\n') {
|
||||||
printf("- %s suggested %s", key2, val2);
|
printf("- %s suggested %s", key3, val2);
|
||||||
} else {
|
} else {
|
||||||
printf("- %s suggested %s\n", key2, val2);
|
printf("- %s suggested %s\n", key3, val2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(key3);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include "main.h"
|
#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) {
|
void init_tables(hashmap *elements, hashmap *inv, hashmap *polls, int do_inv) {
|
||||||
load_elements(elements, "../elem_data/" combo_file, 0);
|
load_elements(elements, "../elem_data/" combo_file, 0);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#define combo_file "combos.txt"
|
#define combo_file "combos.txt"
|
||||||
#define poll_file "polls.txt"
|
#define poll_file "polls.txt"
|
||||||
#define polls_lock_file "polls_lock.txt"
|
#define polls_lock_file "polls_lock.txt"
|
||||||
|
#define lb_file "lb.txt"
|
||||||
|
|
||||||
#define MAX_BUF_LENGTH 1024
|
#define MAX_BUF_LENGTH 1024
|
||||||
#define MAX_COMBO_LENGTH 1024
|
#define MAX_COMBO_LENGTH 1024
|
||||||
|
|
Loading…
Reference in a new issue