X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fclient%2Fwincontrol.c;h=5e818badd0b3d21d473b992e27ec4504defd94dc;hb=1befe1034a6330301d4af2df80aaa98430a6e8c9;hp=eda233b43ab762d3bdba90f6fe6e4bc486731770;hpb=5017468632ebf51485743c7d71b569c78ab0cf7f;p=plomrogue diff --git a/src/client/wincontrol.c b/src/client/wincontrol.c index eda233b..5e818ba 100644 --- a/src/client/wincontrol.c +++ b/src/client/wincontrol.c @@ -3,6 +3,7 @@ #include "wincontrol.h" #include /* global errno */ #include /* DIR, struct dirent, opendir(), closedir(), readdir() */ +#include /* NULL */ #include /* uint8_t, uint16_t, uint32_t */ #include /* FILE */ #include /* free(), atoi() */ @@ -117,9 +118,8 @@ static void init_winconf_from_file(char id, struct WinConf * winconf) kb_p->next = 0; kb_p->key = atoi(command); cmdptr = strchr(command, ' ') + 1; - kb_p->command = try_malloc(strlen(cmdptr), context); - memcpy(kb_p->command, cmdptr, strlen(cmdptr) - 1); - kb_p->command[strlen(cmdptr) - 1] = '\0'; + cmdptr[strlen(cmdptr) - 1] = '\0'; + kb_p->command = get_command(cmdptr); loc_last_ptr = & kb_p->next; } @@ -174,9 +174,9 @@ static void save_win_config(char id) struct KeyBinding * kb_p = wc->kb.kbs; while (0 != kb_p) { - if (strlen(kb_p->command) > linemax) + if (strlen(kb_p->command->dsc_short) > linemax) { - linemax = strlen(kb_p->command); + linemax = strlen(kb_p->command->dsc_short); } kb_p = kb_p->next; } @@ -185,7 +185,7 @@ static void save_win_config(char id) kb_p = wc->kb.kbs; while (0 != kb_p) { - sprintf(kb_line, "%d %s\n", kb_p->key, kb_p->command); + sprintf(kb_line, "%d %s\n", kb_p->key, kb_p->command->dsc_short); try_fwrite(kb_line, sizeof(char), strlen(kb_line), file, f_name); kb_p = kb_p->next; }