summaryrefslogtreecommitdiffstats
path: root/pattern.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1998-08-25 22:33:07 +0000
committerThomas Roessler <roessler@does-not-exist.org>1998-08-25 22:33:07 +0000
commit986ab5e943db7aaed2aed98f8b74e4c26666fdd8 (patch)
tree58cfec1114686823dbdbf22cf2ca52f77eb1075d /pattern.c
parent9044dd4d58af4b4d64a6e68b7b76c42d317e7ce5 (diff)
CVS branch clean-up.
Diffstat (limited to 'pattern.c')
-rw-r--r--pattern.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/pattern.c b/pattern.c
index 0435ac76..2b6d857c 100644
--- a/pattern.c
+++ b/pattern.c
@@ -108,7 +108,7 @@ int mutt_which_case (const char *s)
{
while (*s)
{
- if (isalpha (*s) && isupper (*s))
+ if (isalpha ((unsigned char) *s) && isupper ((unsigned char) *s))
return 0; /* case-sensitive */
s++;
}
@@ -242,14 +242,17 @@ int eat_regexp (pattern_t *pat, BUFFER *s, BUFFER *err)
int eat_range (pattern_t *pat, BUFFER *s, BUFFER *err)
{
char *tmp;
-
+ int do_exclusive = 0;
+
+ if (*s->dptr == '<')
+ do_exclusive = 1;
if ((*s->dptr != '-') && (*s->dptr != '<'))
{
/* range minimum */
if (*s->dptr == '>')
{
pat->max = M_MAXRANGE;
- pat->min = strtol (s->dptr + 1, &tmp, 0);
+ pat->min = strtol (s->dptr + 1, &tmp, 0) + 1; /* exclusive range */
}
else
pat->min = strtol (s->dptr, &tmp, 0);
@@ -283,7 +286,7 @@ int eat_range (pattern_t *pat, BUFFER *s, BUFFER *err)
tmp = s->dptr;
}
- if (isdigit (*tmp))
+ if (isdigit ((unsigned char) *tmp))
{
/* range maximum */
pat->max = strtol (tmp, &tmp, 0);
@@ -297,6 +300,8 @@ int eat_range (pattern_t *pat, BUFFER *s, BUFFER *err)
pat->max *= 1048576;
tmp++;
}
+ if (do_exclusive)
+ (pat->max)--;
}
else
pat->max = M_MAXRANGE;
@@ -792,7 +797,7 @@ mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags, CONTEXT *ctx,
return (pat->not ^ (h->score >= pat->min && (pat->max == M_MAXRANGE ||
h->score <= pat->max)));
case M_SIZE:
- return (pat->not ^ (h->content->length > pat->min && (pat->max == M_MAXRANGE || h->content->length < pat->max)));
+ return (pat->not ^ (h->content->length >= pat->min && (pat->max == M_MAXRANGE || h->content->length <= pat->max)));
case M_REFERENCE:
return (pat->not ^ match_reference (pat->rx, h->env->references));
case M_ADDRESS:
@@ -865,7 +870,7 @@ void mutt_check_simple (char *s, size_t len, const char *simple)
}
}
-int mutt_pattern_func (int op, char *prompt, HEADER *hdr)
+int mutt_pattern_func (int op, char *prompt)
{
pattern_t *pat;
char buf[LONG_STRING] = "", *simple, error[STRING];