home · contact · privacy
Simplified textfile_sizes() and replaced all get_linemax() calls with it.
[plomrogue] / src / keybindings.c
index 709813c89a98a6d98832a37085acaf013c4ff991..0fd2cdcd56d77d47f831145ced0eb09a2c0a7559 100644 (file)
@@ -37,6 +37,21 @@ static uint8_t try_keycode(uint16_t keycode_given, char * keyname,
 
 
 
+extern char * get_func_to_keycode(struct KeyBinding * kb_p, uint16_t key)
+{
+    while (0 != kb_p)
+    {
+        if (key == kb_p->key)
+        {
+            return kb_p->name;
+        }
+        kb_p = kb_p->next;
+    }
+    return NULL;
+}
+
+
+
 extern uint16_t get_keycode_to_action(struct KeyBinding * kb_p, char * name)
 {
     while (0 != kb_p)
@@ -131,9 +146,8 @@ extern void init_keybindings(char * path, struct KeyBiData * kbd)
     char * f_name = "init_keybindings()";
 
     FILE * file = try_fopen(path, "r", f_name);
-    uint16_t lines, linemax;
-    char * err = "textfile_sizes() in init_keybindings() returns error.";
-    exit_err(textfile_sizes(file, &linemax, &lines), err);
+    uint16_t lines;
+    uint16_t linemax = textfile_sizes(file, &lines);
 
     char command[linemax + 1];
     char * cmdptr;
@@ -218,8 +232,7 @@ extern void free_keybindings(struct KeyBinding * kb_start)
 extern void mod_selected_keyb(struct KeyBiData * kbd)
 {
     kbd->edit = 1;
-    char * err = "Trouble with draw_all_wins() in mod_selected_keyb().";
-    exit_err(draw_all_wins(world.wmeta), err);
+    draw_all_wins();
     int key = getch();
     if (key < 1000)
     {