diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 1998-09-07 09:13:53 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 1998-09-07 09:13:53 +0000 |
commit | 423c59fb6162497ac9302d8e34e13af0fa683ef8 (patch) | |
tree | 360f2127223a02b26ffc2eff12a5057c278c48dc /pattern.c | |
parent | 6a9bbb7efd174f8cf57846da3e927ea2672d3bdb (diff) |
Fix simple patterns.
Diffstat (limited to 'pattern.c')
-rw-r--r-- | pattern.c | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -824,6 +824,21 @@ mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags, CONTEXT *ctx, return (-1); } +static void quote_simple(char *tmp, size_t len, const char *p) +{ + int i = 0; + + tmp[i++] = '"'; + while (*p && i < len - 2) + { + if (*p == '\\' || *p == '"') + tmp[i++] = '\\'; + tmp[i++] = *p++; + } + tmp[i++] = '"'; + tmp[i] = 0; +} + /* convert a simple search into a real request */ void mutt_check_simple (char *s, size_t len, const char *simple) { @@ -853,18 +868,7 @@ void mutt_check_simple (char *s, size_t len, const char *simple) strfcpy (s, "~U", len); else { - const char *p = s; - int i = 0; - - tmp[i++] = '"'; - while (*p && i < sizeof (tmp) - 2) - { - if (*p == '\\' || *p == '"') - tmp[i++] = '\\'; - tmp[i++] = *p++; - } - tmp[i++] = '"'; - tmp[i] = 0; + quote_simple (tmp, sizeof(tmp), s); mutt_expand_fmt (s, len, simple, tmp); } } |