Use m_tempfile and better errors msg
[apps/madmutt.git] / keymap.c
index c7cede6..7be6869 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -7,29 +7,15 @@
  * please see the file GPL in the top level source directory.
  */
 
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <lib-lib/mem.h>
-#include <lib-lib/ascii.h>
-#include <lib-lib/str.h>
-#include <lib-lib/macros.h>
-#include <lib-lib/buffer.h>
-#include <lib-lib/mapping.h>
+#include <lib-lib/lib-lib.h>
 
 #include <lib-ui/curses.h>
+#include <lib-ui/menu.h>
 
 #include "mutt.h"
-#include "mutt_menu.h"
 #include "keymap.h"
 #include <lib-crypt/crypt.h>
 
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
 #define MUTT_FUNCTIONS_VALUES
 #include "functions.def"
 
@@ -50,19 +36,15 @@ struct mapping_t Menus[] = {
   {"key_select_smime", MENU_KEY_SELECT_SMIME},
 #endif
 
-
 #ifdef MIXMASTER
   {"mix", MENU_MIX},
 #endif
 
-
   {"query", MENU_QUERY},
   {"generic", MENU_GENERIC},
   {NULL, 0}
 };
 
-#define mutt_check_menu(s) mutt_getvaluebyname(s, Menus)
-
 static struct mapping_t KeyNames[] = {
   {"<PageUp>", KEY_PPAGE},
   {"<PageDown>", KEY_NPAGE},
@@ -478,7 +460,7 @@ const char *km_keyname(int c)
   }
   else if (c >= KEY_F0 && c < KEY_F (256))      /* this maximum is just a guess */
     sprintf (buf, "<F%d>", c - KEY_F0);
-  else if (IsPrint (c))
+  else if (isprint((unsigned char)c))
     snprintf (buf, sizeof (buf), "%c", (unsigned char) c);
   else
     snprintf (buf, sizeof (buf), "\\x%hx", (unsigned short) c);
@@ -687,7 +669,7 @@ static char *parse_keymap (int *menu, BUFFER * s, int maxmenus, int *nummenus,
       if (q)
         *q = '\0';
 
-      if ((menu[i] = mutt_check_menu (p)) == -1) {
+      if ((menu[i] = mutt_getvaluebyname(p, Menus)) == -1) {
         snprintf (err->data, err->dsize, _("%s: no such menu"), p);
         goto error;
       }