remove some mutt_mktemp
[apps/madmutt.git] / pattern.c
index 32a5094..c8dff19 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -7,33 +7,16 @@
  * please see the file GPL in the top level source directory.
  */
 
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdarg.h>
-
-#include <lib-lib/mem.h>
-#include <lib-lib/ascii.h>
-#include <lib-lib/str.h>
-#include <lib-lib/macros.h>
-#include <lib-lib/file.h>
-#include <lib-lib/buffer.h>
-#include <lib-lib/mapping.h>
+#include <lib-lib/lib-lib.h>
 
 #include <lib-mime/mime.h>
-
 #include <lib-ui/enter.h>
+#include <lib-ui/curses.h>
+#include <lib-mx/mx.h>
 
 #include "mutt.h"
 #include "alias.h"
 #include "handler.h"
-#include "mx.h"
 #include "keymap.h"
 #include "copy.h"
 
@@ -119,19 +102,6 @@ static char LastSearchExpn[LONG_STRING] = { 0 };        /* expanded version of
 #define M_PDR_ERROR    0x0100
 #define M_PDR_ERRORDONE        (M_PDR_ERROR | M_PDR_DONE)
 
-
-int mutt_getvaluebychar (char ch, struct mapping_t *table)
-{
-  int i;
-
-  for (i = 0; table[i].name; i++) {
-    if (ch == table[i].name[0])
-      return table[i].value;
-  }
-
-  return (-1);
-}
-
 /* if no uppercase letters are given, do a case-insensitive search */
 int mutt_which_case (const char *s)
 {
@@ -163,9 +133,9 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno)
       p_clear(&s, 1);
       s.fpin = msg->fp;
       s.flags = M_CHARCONV;
-      mutt_mktemp (tempfile);
-      if ((s.fpout = safe_fopen (tempfile, "w+")) == NULL) {
-        mutt_perror (tempfile);
+      s.fpout = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL);
+      if (!s.fpout) {
+        mutt_error(_("Could not create temporary file"));
         return (0);
       }
 
@@ -1171,7 +1141,7 @@ void mutt_check_simple (char *s, ssize_t len, const char *simple)
       m_strcpy(s, len, "~U");
     else {
       quote_simple (tmp, sizeof (tmp), s);
-      mutt_expand_fmt (s, len, simple, tmp);
+      m_file_fmt(s, len, simple, tmp);
     }
   }
 }