- }
- t->nmatch++; /* match 0 is always the whole expr */
-
- return 0;
-}
-
-static int remove_from_spam_list (SPAM_LIST ** list, const char *pat)
-{
- SPAM_LIST *spam, *prev;
- int nremoved = 0;
-
- /* Being first is a special case. */
- spam = *list;
- if (!spam)
- return 0;
- if (spam->rx && !str_cmp (spam->rx->pattern, pat)) {
- *list = spam->next;
- rx_free (&spam->rx);
- mem_free(&spam->template);
- mem_free(&spam);
- return 1;
- }
-
- prev = spam;
- for (spam = prev->next; spam;) {
- if (!str_cmp (spam->rx->pattern, pat)) {
- prev->next = spam->next;
- rx_free (&spam->rx);
- mem_free(spam->template);
- mem_free(spam);
- spam = prev->next;
- ++nremoved;
- }
- else
- spam = spam->next;
- }
-
- return nremoved;
-}
-
-
-static void remove_from_list (LIST ** l, const char *str)
-{
- LIST *p, *last = NULL;
-
- if (str_cmp ("*", str) == 0)
- mutt_free_list (l); /* ``unCMD *'' means delete all current entries */
- else {
- p = *l;
- last = NULL;
- while (p) {
- if (ascii_strcasecmp (str, p->data) == 0) {
- mem_free (&p->data);
- if (last)
- last->next = p->next;
- else
- (*l) = p->next;
- mem_free (&p);
- }
- else {
- last = p;
- p = p->next;
- }
- }
- }
-}
-
-static int remove_from_rx_list (list2_t** l, const char *str)
-{
- int i = 0;
-
- if (str_cmp ("*", str) == 0) {
- list_del (l, (list_del_t*) rx_free);
- return (0);
- }
- else {
- i = rx_lookup ((*l), str);
- if (i >= 0) {
- rx_t* r = list_pop_idx ((*l), i);
- rx_free (&r);
- return (0);
- }
- }
- return (-1);
-}
-
-static int parse_ifdef (BUFFER * tmp, BUFFER * s, unsigned long data,
- BUFFER * err)
-{
- int i, j, res = 0;
- BUFFER token;
-
- memset (&token, 0, sizeof (token));
- mutt_extract_token (tmp, s, 0);
-
- /* is the item defined as a variable or a function? */
- if (!(res = (mutt_option_index (tmp->data) != -1)))
- for (i = 0; !res && i < MENU_MAX; i++) {
- struct binding_t *b = km_get_table (Menus[i].value);
-
- if (!b)
- continue;
-
- for (j = 0; b[j].name; j++)
- if (!ascii_strncasecmp (tmp->data, b[j].name, str_len (tmp->data))
- && (str_len (b[j].name) == str_len (tmp->data))) {
- res = 1;
- break;
- }
- }
- /* check for feature_* */
- if (!res) {
- char *p = NULL;
-
- i = 0;
- j = str_len (tmp->data);
- /* need at least input of 'feature_X' */
- if (j >= 7) {
- p = tmp->data + 7;
- j -= 7;
- while (Features[i].name) {
- if (str_len (Features[i].name) == j &&
- ascii_strncasecmp (Features[i].name, p, j)) {
- res = 1;
- break;
- }
- i++;
- }