move more files.
[apps/madmutt.git] / pattern.c
index 335337e..95157b1 100644 (file)
--- a/pattern.c
+++ b/pattern.c
 
 #include <lib-mime/mime.h>
 
+#include <lib-ui/enter.h>
+
 #include "mutt.h"
 #include "handler.h"
-#include "enter.h"
 #include "mx.h"
 #include "keymap.h"
 #include "copy.h"
 
-
-#ifdef USE_IMAP
-#include "mx.h"
-#include "imap/imap.h"
-#endif
+#include <imap/imap.h>
 
 #include <string.h>
 #include <stdlib.h>
@@ -41,7 +38,7 @@
 #include <unistd.h>
 #include <stdarg.h>
 
-#include "mutt_crypt.h"
+#include <lib-crypt/crypt.h>
 
 static int eat_regexp (pattern_t * pat, BUFFER *, BUFFER *);
 static int eat_date (pattern_t * pat, BUFFER *, BUFFER *);
@@ -160,7 +157,7 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno)
   int match = 0;
   HEADER *h = ctx->hdrs[msgno];
   char* buf;
-  size_t blen;
+  ssize_t blen;
 
   if ((msg = mx_open_message (ctx, msgno)) != NULL) {
     if (option (OPTTHOROUGHSRC)) {
@@ -219,7 +216,7 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno)
     /* search the file "fp" */
     while (lng > 0) {
       if (pat->op == M_HEADER) {
-        if (*(buf = mutt_read_rfc822_line (fp, buf, &blen)) == '\0')
+        if (!mutt_read_rfc822_line(fp, &buf, &blen))
           break;
       } else if (fgets (buf, blen - 1, fp) == NULL)
         break;                  /* don't loop forever */
@@ -291,7 +288,7 @@ static int patmatch (const pattern_t* pat, const char* buf) {
     return regexec (pat->rx, buf, 0, NULL, 0);
 }
 
-int eat_range (pattern_t * pat, BUFFER * s, BUFFER * err)
+int eat_range (pattern_t * pat, BUFFER * s, BUFFER * err __attribute__ ((unused)))
 {
   char *tmp;
   int do_exclusive = 0;
@@ -873,7 +870,7 @@ perform_or (struct pattern_t *pat, pattern_exec_flag flags, CONTEXT * ctx,
   return 0;
 }
 
-static int match_adrlist (pattern_t* pat, int match_personal, int alladdr,
+static int match_adrlist (pattern_t* pat, int match_personal, int alladdr __attribute__ ((unused)),
                           int n, ...)
 {
   va_list ap;
@@ -1000,11 +997,9 @@ mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags,
   case M_BODY:
   case M_HEADER:
   case M_WHOLE_MSG:
-#ifdef USE_IMAP
     /* IMAP search sets h->matched at search compile time */
     if (ctx->magic == M_IMAP && pat->stringmatch)
       return (h->matched);
-#endif
     return (pat->not ^ msg_search (ctx, pat, h->msgno));
   case M_SENDER:
     return (pat->not ^ match_adrlist (pat, flags & M_MATCH_FULL_ADDRESS,
@@ -1137,9 +1132,9 @@ mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags,
   return (-1);
 }
 
-static void quote_simple (char *tmp, size_t len, const char *p)
+static void quote_simple (char *tmp, ssize_t len, const char *p)
 {
-  int i = 0;
+  ssize_t i = 0;
 
   tmp[i++] = '"';
   while (*p && i < len - 3) {
@@ -1212,10 +1207,8 @@ int mutt_pattern_func (int op, char *prompt)
     return (-1);
   }
 
-#ifdef USE_IMAP
   if (Context->magic == M_IMAP && imap_search (Context, pat) < 0)
     return -1;
-#endif
 
   mutt_message _("Executing command on matching messages...");
 
@@ -1343,10 +1336,8 @@ int mutt_search_command (int cur, int op)
   if (option (OPTSEARCHINVALID)) {
     for (i = 0; i < Context->msgcount; i++)
       Context->hdrs[i]->searched = 0;
-#ifdef USE_IMAP
     if (Context->magic == M_IMAP && imap_search (Context, SearchPattern) < 0)
       return -1;
-#endif
     unset_option (OPTSEARCHINVALID);
   }