X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=pattern.c;h=4db49bf5f5e76ed3d8e1a1b33853e01c687ee11b;hp=cef1722b9092de735ff907321b3a5bda7bc72ac1;hb=3de2c85955793f4d6898884915121959ca465d0f;hpb=711f787502b6a1a1c150b948a5ed9156c8ef9ba1 diff --git a/pattern.c b/pattern.c index cef1722..4db49bf 100644 --- 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 -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include +#include #include - #include +#include +#include #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); } @@ -179,7 +149,7 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno) { mx_close_message (&msg); if (fp) { - fclose (fp); + m_fclose(&fp); unlink (tempfile); } return (0); @@ -230,7 +200,7 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno) mx_close_message (&msg); if (option (OPTTHOROUGHSRC)) { - fclose (fp); + m_fclose(&fp); unlink (tempfile); } } @@ -256,12 +226,6 @@ int eat_regexp (pattern_t * pat, BUFFER * s, BUFFER * err) return (-1); } -#if 0 - /* If there are no RE metacharacters, use simple search anyway */ - if (!pat->stringmatch && !strpbrk (buf.data, "|[{.*+?^$")) - pat->stringmatch = 1; -#endif - if (pat->stringmatch) { pat->str = m_strdup(buf.data); p_delete(&buf.data); @@ -1090,7 +1054,7 @@ mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags, else { mutt_parse_mime_message(ctx, h); count = mutt_count_body_parts(h, 0); - mutt_free_body(&h->content->parts); + body_list_wipe(&h->content->parts); } return (pat->not ^ (count >= pat->min && (pat->max == M_MAXRANGE || @@ -1171,7 +1135,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); } } }