home · contact · privacy
Simplified client control library and interaction with it.
[plomrogue] / src / client / wincontrol.c
index eda233b43ab762d3bdba90f6fe6e4bc486731770..b241eba3d4ac271e05bfd3e38ad854503792295a 100644 (file)
@@ -117,9 +117,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 +173,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 +184,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;
     }