-#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-ui/curses.h>
+#include <lib-ui/menu.h>
static struct mapping_t KeyNames[] = {
{"<PageUp>", KEY_PPAGE},
{"<PageDown>", KEY_NPAGE},
static struct mapping_t KeyNames[] = {
{"<PageUp>", KEY_PPAGE},
{"<PageDown>", KEY_NPAGE},
- if (isdigit ((unsigned char) s[1]) &&
- isdigit ((unsigned char) s[2]) &&
- isdigit ((unsigned char) s[3]) && s[4] == '>') {
- return (s[3] - '0') + (s[2] - '0') * 8 + (s[1] - '0') * 64;
- }
- return -1;
+ int n;
+
+ if (*s != '<')
+ return -1;
+ n = strtol(s + 1, (char **)&s, 8);
+ return *s == '>' ? n : -1;
}
else if (c >= KEY_F0 && c < KEY_F (256)) /* this maximum is just a guess */
sprintf (buf, "<F%d>", c - KEY_F0);
}
else if (c >= KEY_F0 && c < KEY_F (256)) /* this maximum is just a guess */
sprintf (buf, "<F%d>", c - KEY_F0);
snprintf (buf, sizeof (buf), "%c", (unsigned char) c);
else
snprintf (buf, sizeof (buf), "\\x%hx", (unsigned short) c);
snprintf (buf, sizeof (buf), "%c", (unsigned char) c);
else
snprintf (buf, sizeof (buf), "\\x%hx", (unsigned short) c);
create_bindings (OpPost, MENU_POST);
create_bindings (OpQuery, MENU_QUERY);
create_bindings (OpAlias, MENU_ALIAS);
create_bindings (OpPost, MENU_POST);
create_bindings (OpQuery, MENU_QUERY);
create_bindings (OpAlias, MENU_ALIAS);
create_bindings (OpPgp, MENU_PGP);
create_bindings (OpSmime, MENU_SMIME);
create_bindings (OpPgp, MENU_PGP);
create_bindings (OpSmime, MENU_SMIME);
create_bindings (OpMix, MENU_MIX);
km_bindkey ("<space>", MENU_MIX, OP_GENERIC_SELECT_ENTRY);
km_bindkey ("h", MENU_MIX, OP_MIX_CHAIN_PREV);
km_bindkey ("l", MENU_MIX, OP_MIX_CHAIN_NEXT);
create_bindings (OpMix, MENU_MIX);
km_bindkey ("<space>", MENU_MIX, OP_GENERIC_SELECT_ENTRY);
km_bindkey ("h", MENU_MIX, OP_MIX_CHAIN_PREV);
km_bindkey ("l", MENU_MIX, OP_MIX_CHAIN_NEXT);
/* bindings for the line editor */
create_bindings (OpEditor, MENU_EDITOR);
/* bindings for the line editor */
create_bindings (OpEditor, MENU_EDITOR);
snprintf (err->data, err->dsize, _("%s: no such menu"), p);
goto error;
}
snprintf (err->data, err->dsize, _("%s: no such menu"), p);
goto error;
}
- if ((key = parse_keymap (menu, s, sizeof (menu) / sizeof (menu[0]),
- &nummenus, err)) == NULL)
- return (-1);
+ if (!(key = parse_keymap(menu, s, countof(menu), &nummenus, err)))
+ return -1;
/* function to execute */
mutt_extract_token (buf, s, 0);
/* function to execute */
mutt_extract_token (buf, s, 0);