always build imap as well.
[apps/madmutt.git] / keymap.c
index 29e0dcd..272fe0a 100644 (file)
--- a/keymap.c
+++ b/keymap.c
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 #include <lib-lib/buffer.h>
+#include <lib-lib/mapping.h>
 
 #include "mutt.h"
 #include "mutt_menu.h"
 #include "mutt_curses.h"
 #include "keymap.h"
-#include "mapping.h"
 #include "mutt_crypt.h"
 
 
@@ -29,7 +29,8 @@
 #include <string.h>
 #include <ctype.h>
 
-#include "functions.h"
+#define MUTT_FUNCTIONS_VALUES
+#include "functions.def"
 
 struct mapping_t Menus[] = {
   {"alias", MENU_ALIAS},
@@ -144,7 +145,7 @@ static int parsekeys (const char *str, keycode_t * d, int max)
   char c;
   char *s, *t;
 
-  strfcpy (buff, str, sizeof (buff));
+  m_strcpy(buff, sizeof(buff), str);
   s = buff;
 
   while (*s && len) {
@@ -272,9 +273,9 @@ static const char *get_func (struct binding_t *bindings, int op)
   return NULL;
 }
 
-static void push_string (char *s)
+static void push_string(const char *s)
 {
-  char *pp, *p = s + m_strlen(s) - 1;
+  const char *pp, *p = s + m_strlen(s) - 1;
   size_t l;
   int i, op = OP_NULL;
 
@@ -403,7 +404,7 @@ int km_dokey (int menu)
             /* careful not to feed the <..> as one token. otherwise 
              * push_string() will push the bogus op right back! */
             mutt_ungetch ('>', 0);
-            push_string (func);
+            push_string(func);
             mutt_ungetch ('<', 0);
             break;
           }
@@ -492,7 +493,7 @@ int km_expand_key (char *s, size_t len, struct keymap_t *map)
     return (0);
 
   for (;;) {
-    strfcpy (s, km_keyname (map->keys[p]), len);
+    m_strcpy(s, len, km_keyname(map->keys[p]));
     len -= (l = m_strlen(s));
 
     if (++p >= map->len || !len)
@@ -528,11 +529,8 @@ void km_init (void)
   create_bindings (OpAlias, MENU_ALIAS);
 
 
-  if ((WithCrypto & APPLICATION_PGP))
-    create_bindings (OpPgp, MENU_PGP);
-
-  if ((WithCrypto & APPLICATION_SMIME))
-    create_bindings (OpSmime, MENU_SMIME);
+  create_bindings (OpPgp, MENU_PGP);
+  create_bindings (OpSmime, MENU_SMIME);
 
 #ifdef CRYPT_BACKEND_GPGME
   create_bindings (OpPgp, MENU_KEY_SELECT_PGP);
@@ -661,7 +659,7 @@ int mutt_parse_push (BUFFER * buf, BUFFER * s, unsigned long data,
 
   mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
   if (MoreArgs (s)) {
-    strfcpy (err->data, _("push: too many arguments"), err->dsize);
+    m_strcpy(err->data, err->dsize, _("push: too many arguments"));
     r = -1;
   }
   else
@@ -703,13 +701,13 @@ static char *parse_keymap (int *menu, BUFFER * s, int maxmenus, int *nummenus,
     mutt_extract_token (&buf, s, 0);
 
     if (!*buf.data) {
-      strfcpy (err->data, _("null key sequence"), err->dsize);
+      m_strcpy(err->data, err->dsize, _("null key sequence"));
     }
     else if (MoreArgs (s))
       return (buf.data);
   }
   else {
-    strfcpy (err->data, _("too few arguments"), err->dsize);
+    m_strcpy(err->data, err->dsize, _("too few arguments"));
   }
 error:
   p_delete(&buf.data);
@@ -754,7 +752,7 @@ struct binding_t *km_get_table (int menu)
     return OpQuery;
 
   case MENU_PGP:
-    return (WithCrypto & APPLICATION_PGP) ? OpPgp : NULL;
+    return OpPgp;
 
 #ifdef CRYPT_BACKEND_GPGME
   case MENU_KEY_SELECT_PGP:
@@ -788,7 +786,7 @@ int mutt_parse_bind (BUFFER * buf, BUFFER * s, unsigned long data,
   /* function to execute */
   mutt_extract_token (buf, s, 0);
   if (MoreArgs (s)) {
-    strfcpy (err->data, _("bind: too many arguments"), err->dsize);
+    m_strcpy(err->data, err->dsize, _("bind: too many arguments"));
     r = -1;
   }
   else if (ascii_strcasecmp ("noop", buf->data) == 0) {
@@ -833,7 +831,7 @@ int mutt_parse_macro (BUFFER * buf, BUFFER * s, unsigned long data,
   mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
   /* make sure the macro sequence is not an empty string */
   if (!*buf->data) {
-    strfcpy (err->data, _("macro: empty key sequence"), err->dsize);
+    m_strcpy(err->data, err->dsize, _("macro: empty key sequence"));
   }
   else {
     if (MoreArgs (s)) {
@@ -841,7 +839,7 @@ int mutt_parse_macro (BUFFER * buf, BUFFER * s, unsigned long data,
       mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
 
       if (MoreArgs (s)) {
-        strfcpy (err->data, _("macro: too many arguments"), err->dsize);
+        m_strcpy(err->data, err->dsize, _("macro: too many arguments"));
       }
       else {
         for (i = 0; i < nummenus; ++i) {
@@ -873,7 +871,7 @@ int mutt_parse_exec (BUFFER * buf, BUFFER * s, unsigned long data,
   char *function;
 
   if (!MoreArgs (s)) {
-    strfcpy (err->data, _("exec: no arguments"), err->dsize);
+    m_strcpy(err->data, err->dsize, _("exec: no arguments"));
     return (-1);
   }