Rocco Rutte:
[apps/madmutt.git] / init.c
diff --git a/init.c b/init.c
index e8eabd3..35577a4 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1,25 +1,19 @@
 /*
 /*
+ * Copyright notice from original mutt:
  * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
  * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
- * 
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- * 
- *     This program is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- * 
- *     You should have received a copy of the GNU General Public License
- *     along with this program; if not, write to the Free Software
- *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
- */ 
+ *
+ * This file is part of mutt-ng, see http://www.muttng.org/.
+ * It's licensed under the GNU General Public License,
+ * please see the file GPL in the top level source directory.
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include "mutt.h"
 #include "mapping.h"
 #include "mutt_curses.h"
 
 #include "mutt.h"
 #include "mapping.h"
 #include "mutt_curses.h"
-#include "mutt_regex.h"
 #include "history.h"
 #include "keymap.h"
 #include "mbyte.h"
 #include "history.h"
 #include "keymap.h"
 #include "mbyte.h"
 #include "mutt_ssl.h"
 #endif
 
 #include "mutt_ssl.h"
 #endif
 
-
-
 #include "mx.h"
 #include "init.h"
 #include "mailbox.h"
 
 #include "mx.h"
 #include "init.h"
 #include "mailbox.h"
 
+#include "lib/mem.h"
+#include "lib/intl.h"
+#include "lib/str.h"
+#include "lib/rx.h"
+
 #include <ctype.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <ctype.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -47,7 +44,7 @@
 
 void toggle_quadoption (int opt)
 {
 
 void toggle_quadoption (int opt)
 {
-  int n = opt/4;
+  int n = opt / 4;
   int b = (opt % 4) * 2;
 
   QuadOptions[n] ^= (1 << b);
   int b = (opt % 4) * 2;
 
   QuadOptions[n] ^= (1 << b);
@@ -55,7 +52,7 @@ void toggle_quadoption (int opt)
 
 void set_quadoption (int opt, int flag)
 {
 
 void set_quadoption (int opt, int flag)
 {
-  int n = opt/4;
+  int n = opt / 4;
   int b = (opt % 4) * 2;
 
   QuadOptions[n] &= ~(0x3 << b);
   int b = (opt % 4) * 2;
 
   QuadOptions[n] &= ~(0x3 << b);
@@ -64,7 +61,7 @@ void set_quadoption (int opt, int flag)
 
 int quadoption (int opt)
 {
 
 int quadoption (int opt)
 {
-  int n = opt/4;
+  int n = opt / 4;
   int b = (opt % 4) * 2;
 
   return (QuadOptions[n] >> b) & 0x3;
   int b = (opt % 4) * 2;
 
   return (QuadOptions[n] >> b) & 0x3;
@@ -74,16 +71,15 @@ int query_quadoption (int opt, const char *prompt)
 {
   int v = quadoption (opt);
 
 {
   int v = quadoption (opt);
 
-  switch (v)
-  {
-    case M_YES:
-    case M_NO:
-      return (v);
+  switch (v) {
+  case M_YES:
+  case M_NO:
+    return (v);
 
 
-    default:
-      v = mutt_yesorno (prompt, (v == M_ASKYES));
-      CLEARLINE (LINES - 1);
-      return (v);
+  default:
+    v = mutt_yesorno (prompt, (v == M_ASKYES));
+    CLEARLINE (LINES - 1);
+    return (v);
   }
 
   /* not reached */
   }
 
   /* not reached */
@@ -97,126 +93,120 @@ int mutt_option_index (char *s)
 
   for (i = 0; MuttVars[i].option; i++)
     if (mutt_strcmp (s, MuttVars[i].option) == 0)
 
   for (i = 0; MuttVars[i].option; i++)
     if (mutt_strcmp (s, MuttVars[i].option) == 0)
-      return (MuttVars[i].type == DT_SYN ?  mutt_option_index ((char *) MuttVars[i].data) : i);
+      return (MuttVars[i].type ==
+              DT_SYN ? mutt_option_index ((char *) MuttVars[i].data) : i);
   return (-1);
 }
 
   return (-1);
 }
 
-int mutt_extract_token (BUFFER *dest, BUFFER *tok, int flags)
+int mutt_extract_token (BUFFER * dest, BUFFER * tok, int flags)
 {
 {
-  char         ch;
-  char         qc = 0; /* quote char */
-  char         *pc;
+  char ch;
+  char qc = 0;                  /* quote char */
+  char *pc;
 
   /* reset the destination pointer to the beginning of the buffer */
   dest->dptr = dest->data;
 
   SKIPWS (tok->dptr);
 
   /* reset the destination pointer to the beginning of the buffer */
   dest->dptr = dest->data;
 
   SKIPWS (tok->dptr);
-  while ((ch = *tok->dptr))
-  {
-    if (!qc)
-    {
+  while ((ch = *tok->dptr)) {
+    if (!qc) {
       if ((ISSPACE (ch) && !(flags & M_TOKEN_SPACE)) ||
       if ((ISSPACE (ch) && !(flags & M_TOKEN_SPACE)) ||
-         (ch == '#' && !(flags & M_TOKEN_COMMENT)) ||
-         (ch == '=' && (flags & M_TOKEN_EQUAL)) ||
-         (ch == ';' && !(flags & M_TOKEN_SEMICOLON)) ||
-         ((flags & M_TOKEN_PATTERN) && strchr ("~!|", ch)))
-       break;
+          (ch == '#' && !(flags & M_TOKEN_COMMENT)) ||
+          (ch == '=' && (flags & M_TOKEN_EQUAL)) ||
+          (ch == ';' && !(flags & M_TOKEN_SEMICOLON)) ||
+          ((flags & M_TOKEN_PATTERN) && strchr ("~!|", ch)))
+        break;
     }
 
     tok->dptr++;
 
     if (ch == qc)
     }
 
     tok->dptr++;
 
     if (ch == qc)
-      qc = 0; /* end of quote */
+      qc = 0;                   /* end of quote */
     else if (!qc && (ch == '\'' || ch == '"') && !(flags & M_TOKEN_QUOTE))
       qc = ch;
     else if (!qc && (ch == '\'' || ch == '"') && !(flags & M_TOKEN_QUOTE))
       qc = ch;
-    else if (ch == '\\' && qc != '\'')
-    {
-       if (!*tok->dptr)
-           return -1; /* premature end of token */
-      switch (ch = *tok->dptr++)
-      {
-       case 'c':
-       case 'C':
-           if (!*tok->dptr)
-               return -1; /* premature end of token */
-         mutt_buffer_addch (dest, (toupper ((unsigned char) *tok->dptr)
-                                    - '@') & 0x7f);
-         tok->dptr++;
-         break;
-       case 'r':
-         mutt_buffer_addch (dest, '\r');
-         break;
-       case 'n':
-         mutt_buffer_addch (dest, '\n');
-         break;
-       case 't':
-         mutt_buffer_addch (dest, '\t');
-         break;
-       case 'f':
-         mutt_buffer_addch (dest, '\f');
-         break;
-       case 'e':
-         mutt_buffer_addch (dest, '\033');
-         break;
-       default:
-         if (isdigit ((unsigned char) ch) &&
-             isdigit ((unsigned char) *tok->dptr) &&
-             isdigit ((unsigned char) *(tok->dptr + 1)))
-         {
-
-           mutt_buffer_addch (dest, (ch << 6) + (*tok->dptr << 3) + *(tok->dptr + 1) - 3504);
-           tok->dptr += 2;
-         }
-         else
-           mutt_buffer_addch (dest, ch);
+    else if (ch == '\\' && qc != '\'') {
+      if (!*tok->dptr)
+        return -1;              /* premature end of token */
+      switch (ch = *tok->dptr++) {
+      case 'c':
+      case 'C':
+        if (!*tok->dptr)
+          return -1;            /* premature end of token */
+        mutt_buffer_addch (dest, (toupper ((unsigned char) *tok->dptr)
+                                  - '@') & 0x7f);
+        tok->dptr++;
+        break;
+      case 'r':
+        mutt_buffer_addch (dest, '\r');
+        break;
+      case 'n':
+        mutt_buffer_addch (dest, '\n');
+        break;
+      case 't':
+        mutt_buffer_addch (dest, '\t');
+        break;
+      case 'f':
+        mutt_buffer_addch (dest, '\f');
+        break;
+      case 'e':
+        mutt_buffer_addch (dest, '\033');
+        break;
+      default:
+        if (isdigit ((unsigned char) ch) &&
+            isdigit ((unsigned char) *tok->dptr) &&
+            isdigit ((unsigned char) *(tok->dptr + 1))) {
+
+          mutt_buffer_addch (dest,
+                             (ch << 6) + (*tok->dptr << 3) + *(tok->dptr +
+                                                               1) - 3504);
+          tok->dptr += 2;
+        }
+        else
+          mutt_buffer_addch (dest, ch);
       }
     }
       }
     }
-    else if (ch == '^' && (flags & M_TOKEN_CONDENSE))
-    {
-       if (!*tok->dptr)
-           return -1; /* premature end of token */
+    else if (ch == '^' && (flags & M_TOKEN_CONDENSE)) {
+      if (!*tok->dptr)
+        return -1;              /* premature end of token */
       ch = *tok->dptr++;
       if (ch == '^')
       ch = *tok->dptr++;
       if (ch == '^')
-       mutt_buffer_addch (dest, ch);
+        mutt_buffer_addch (dest, ch);
       else if (ch == '[')
       else if (ch == '[')
-       mutt_buffer_addch (dest, '\033');
+        mutt_buffer_addch (dest, '\033');
       else if (isalpha ((unsigned char) ch))
       else if (isalpha ((unsigned char) ch))
-       mutt_buffer_addch (dest, toupper ((unsigned char) ch) - '@');
-      else
-      {
-       mutt_buffer_addch (dest, '^');
-       mutt_buffer_addch (dest, ch);
+        mutt_buffer_addch (dest, toupper ((unsigned char) ch) - '@');
+      else {
+        mutt_buffer_addch (dest, '^');
+        mutt_buffer_addch (dest, ch);
       }
     }
       }
     }
-    else if (ch == '`' && (!qc || qc == '"'))
-    {
-      FILE     *fp;
-      pid_t    pid;
-      char     *cmd, *ptr;
-      size_t   expnlen;
-      BUFFER   expn;
-      int      line = 0;
+    else if (ch == '`' && (!qc || qc == '"')) {
+      FILE *fp;
+      pid_t pid;
+      char *cmd, *ptr;
+      size_t expnlen;
+      BUFFER expn;
+      int line = 0;
 
       pc = tok->dptr;
       do {
 
       pc = tok->dptr;
       do {
-       if ((pc = strpbrk (pc, "\\`")))
-       {
-         /* skip any quoted chars */
-         if (*pc == '\\')
-           pc += 2;
-       }
+        if ((pc = strpbrk (pc, "\\`"))) {
+          /* skip any quoted chars */
+          if (*pc == '\\')
+            pc += 2;
+        }
       } while (pc && *pc != '`');
       } while (pc && *pc != '`');
-      if (!pc)
-      {
-       dprint (1, (debugfile, "mutt_get_token: mismatched backtics\n"));
-       return (-1);
+      if (!pc) {
+        dprint (1, (debugfile, "mutt_get_token: mismatched backtics\n"));
+        return (-1);
       }
       cmd = mutt_substrdup (tok->dptr, pc);
       }
       cmd = mutt_substrdup (tok->dptr, pc);
-      if ((pid = mutt_create_filter (cmd, NULL, &fp, NULL)) < 0)
-      {
-       dprint (1, (debugfile, "mutt_get_token: unable to fork command: %s", cmd));
-       FREE (&cmd);
-       return (-1);
+      if ((pid = mutt_create_filter (cmd, NULL, &fp, NULL)) < 0) {
+        dprint (1,
+                (debugfile, "mutt_get_token: unable to fork command: %s",
+                 cmd));
+        FREE (&cmd);
+        return (-1);
       }
       FREE (&cmd);
 
       }
       FREE (&cmd);
 
@@ -229,63 +219,58 @@ int mutt_extract_token (BUFFER *dest, BUFFER *tok, int flags)
       mutt_wait_filter (pid);
 
       /* if we got output, make a new string consiting of the shell ouptput
       mutt_wait_filter (pid);
 
       /* if we got output, make a new string consiting of the shell ouptput
-        plus whatever else was left on the original line */
+         plus whatever else was left on the original line */
       /* BUT: If this is inside a quoted string, directly add output to 
        * the token */
       /* BUT: If this is inside a quoted string, directly add output to 
        * the token */
-      if (expn.data && qc)
-      {
-       mutt_buffer_addstr (dest, expn.data);
-       FREE (&expn.data);
+      if (expn.data && qc) {
+        mutt_buffer_addstr (dest, expn.data);
+        FREE (&expn.data);
       }
       }
-      else if (expn.data)
-      {
-       expnlen = mutt_strlen (expn.data);
-       tok->dsize = expnlen + mutt_strlen (tok->dptr) + 1;
-       ptr = safe_malloc (tok->dsize);
-       memcpy (ptr, expn.data, expnlen);
-       strcpy (ptr + expnlen, tok->dptr);      /* __STRCPY_CHECKED__ */
-       if (tok->destroy)
-         FREE (&tok->data);
-       tok->data = ptr;
-       tok->dptr = ptr;
-       tok->destroy = 1; /* mark that the caller should destroy this data */
-       ptr = NULL;
-       FREE (&expn.data);
+      else if (expn.data) {
+        expnlen = mutt_strlen (expn.data);
+        tok->dsize = expnlen + mutt_strlen (tok->dptr) + 1;
+        ptr = safe_malloc (tok->dsize);
+        memcpy (ptr, expn.data, expnlen);
+        strcpy (ptr + expnlen, tok->dptr);      /* __STRCPY_CHECKED__ */
+        if (tok->destroy)
+          FREE (&tok->data);
+        tok->data = ptr;
+        tok->dptr = ptr;
+        tok->destroy = 1;       /* mark that the caller should destroy this data */
+        ptr = NULL;
+        FREE (&expn.data);
       }
     }
       }
     }
-    else if (ch == '$' && (!qc || qc == '"') && (*tok->dptr == '{' || isalpha ((unsigned char) *tok->dptr)))
-    {
+    else if (ch == '$' && (!qc || qc == '"')
+             && (*tok->dptr == '{' || isalpha ((unsigned char) *tok->dptr))) {
       char *env = NULL, *var = NULL;
 
       char *env = NULL, *var = NULL;
 
-      if (*tok->dptr == '{')
-      {
-       tok->dptr++;
-       if ((pc = strchr (tok->dptr, '}')))
-       {
-         var = mutt_substrdup (tok->dptr, pc);
-         tok->dptr = pc + 1;
-       }
+      if (*tok->dptr == '{') {
+        tok->dptr++;
+        if ((pc = strchr (tok->dptr, '}'))) {
+          var = mutt_substrdup (tok->dptr, pc);
+          tok->dptr = pc + 1;
+        }
       }
       }
-      else
-      {
-       for (pc = tok->dptr; isalpha ((unsigned char) *pc) || *pc == '_'; pc++)
-         ;
-       var = mutt_substrdup (tok->dptr, pc);
-       tok->dptr = pc;
+      else {
+        for (pc = tok->dptr; isalpha ((unsigned char) *pc) || *pc == '_';
+             pc++);
+        var = mutt_substrdup (tok->dptr, pc);
+        tok->dptr = pc;
       }
       if (var && (env = getenv (var)))
       }
       if (var && (env = getenv (var)))
-       mutt_buffer_addstr (dest, env);
+        mutt_buffer_addstr (dest, env);
       FREE (&var);
     }
     else
       mutt_buffer_addch (dest, ch);
   }
       FREE (&var);
     }
     else
       mutt_buffer_addch (dest, ch);
   }
-  mutt_buffer_addch (dest, 0); /* terminate the string */
+  mutt_buffer_addch (dest, 0);  /* terminate the string */
   SKIPWS (tok->dptr);
   return 0;
 }
 
   SKIPWS (tok->dptr);
   return 0;
 }
 
-static void add_to_list (LIST **list, const char *str)
+static void add_to_list (LIST ** list, const char *str)
 {
   LIST *t, *last = NULL;
 
 {
   LIST *t, *last = NULL;
 
@@ -294,10 +279,8 @@ static void add_to_list (LIST **list, const char *str)
     return;
 
   /* check to make sure the item is not already on this list */
     return;
 
   /* check to make sure the item is not already on this list */
-  for (last = *list; last; last = last->next)
-  {
-    if (ascii_strcasecmp (str, last->data) == 0)
-    {
+  for (last = *list; last; last = last->next) {
+    if (ascii_strcasecmp (str, last->data) == 0) {
       /* already on the list, so just ignore it */
       last = NULL;
       break;
       /* already on the list, so just ignore it */
       last = NULL;
       break;
@@ -306,12 +289,10 @@ static void add_to_list (LIST **list, const char *str)
       break;
   }
 
       break;
   }
 
-  if (!*list || last)
-  {
+  if (!*list || last) {
     t = (LIST *) safe_calloc (1, sizeof (LIST));
     t->data = safe_strdup (str);
     t = (LIST *) safe_calloc (1, sizeof (LIST));
     t->data = safe_strdup (str);
-    if (last)
-    {
+    if (last) {
       last->next = t;
       last = last->next;
     }
       last->next = t;
       last = last->next;
     }
@@ -320,72 +301,47 @@ static void add_to_list (LIST **list, const char *str)
   }
 }
 
   }
 }
 
-static int add_to_rx_list (RX_LIST **list, const char *s, int flags, BUFFER *err)
+static int add_to_rx_list (rx_t ** list, const char *s, int flags,
+                           BUFFER * err)
 {
 {
-  RX_LIST *t, *last = NULL;
-  REGEXP *rx;
+  rx_t* rx;
+  int i = 0;
 
   if (!s || !*s)
     return 0;
 
 
   if (!s || !*s)
     return 0;
 
-  if (!(rx = mutt_compile_regexp (s, flags)))
-  {
+  if (!(rx = rx_compile (s, flags))) {
     snprintf (err->data, err->dsize, "Bad regexp: %s\n", s);
     return -1;
   }
 
     snprintf (err->data, err->dsize, "Bad regexp: %s\n", s);
     return -1;
   }
 
-  /* check to make sure the item is not already on this list */
-  for (last = *list; last; last = last->next)
-  {
-    if (ascii_strcasecmp (rx->pattern, last->rx->pattern) == 0)
-    {
-      /* already on the list, so just ignore it */
-      last = NULL;
-      break;
-    }
-    if (!last->next)
-      break;
-  }
-
-  if (!*list || last)
-  {
-    t = mutt_new_rx_list();
-    t->rx = rx;
-    if (last)
-    {
-      last->next = t;
-      last = last->next;
-    }
-    else
-      *list = last = t;
-  }
-  else /* duplicate */
-    mutt_free_regexp (&rx);
-
+  i = rx_lookup ((*list), rx->pattern);
+  if (i >= 0)
+    rx_free (&rx);
+  else
+    list_push_back (list, rx);
   return 0;
 }
 
   return 0;
 }
 
-static int add_to_spam_list (SPAM_LIST **list, const char *pat, const char *templ, BUFFER *err)
+static int add_to_spam_list (SPAM_LIST ** list, const char *pat,
+                             const char *templ, BUFFER * err)
 {
   SPAM_LIST *t = NULL, *last = NULL;
 {
   SPAM_LIST *t = NULL, *last = NULL;
-  REGEXP *rx;
+  rx_t* rx;
   int n;
   const char *p;
 
   if (!pat || !*pat || !templ)
     return 0;
 
   int n;
   const char *p;
 
   if (!pat || !*pat || !templ)
     return 0;
 
-  if (!(rx = mutt_compile_regexp (pat, REG_ICASE)))
-  {
+  if (!(rx = rx_compile (pat, REG_ICASE))) {
     snprintf (err->data, err->dsize, _("Bad regexp: %s"), pat);
     return -1;
   }
 
   /* check to make sure the item is not already on this list */
     snprintf (err->data, err->dsize, _("Bad regexp: %s"), pat);
     return -1;
   }
 
   /* check to make sure the item is not already on this list */
-  for (last = *list; last; last = last->next)
-  {
-    if (ascii_strcasecmp (rx->pattern, last->rx->pattern) == 0)
-    {
+  for (last = *list; last; last = last->next) {
+    if (ascii_strcasecmp (rx->pattern, last->rx->pattern) == 0) {
       /* Already on the list. Formerly we just skipped this case, but
        * now we're supporting removals, which means we're supporting
        * re-adds conceptually. So we probably want this to imply a
       /* Already on the list. Formerly we just skipped this case, but
        * now we're supporting removals, which means we're supporting
        * re-adds conceptually. So we probably want this to imply a
@@ -393,7 +349,7 @@ static int add_to_spam_list (SPAM_LIST **list, const char *pat, const char *temp
        * the template, and leaving t pointed at the current item.
        */
       t = last;
        * the template, and leaving t pointed at the current item.
        */
       t = last;
-      safe_free(&t->template);
+      FREE(t->template);
       break;
     }
     if (!last->next)
       break;
     }
     if (!last->next)
@@ -403,9 +359,8 @@ static int add_to_spam_list (SPAM_LIST **list, const char *pat, const char *temp
   /* If t is set, it's pointing into an extant SPAM_LIST* that we want to
    * update. Otherwise we want to make a new one to link at the list's end.
    */
   /* If t is set, it's pointing into an extant SPAM_LIST* that we want to
    * update. Otherwise we want to make a new one to link at the list's end.
    */
-  if (!t)
-  {
-    t = mutt_new_spam_list();
+  if (!t) {
+    t = mutt_new_spam_list ();
     t->rx = rx;
     if (last)
       last->next = t;
     t->rx = rx;
     if (last)
       last->next = t;
@@ -414,53 +369,48 @@ static int add_to_spam_list (SPAM_LIST **list, const char *pat, const char *temp
   }
 
   /* Now t is the SPAM_LIST* that we want to modify. It is prepared. */
   }
 
   /* Now t is the SPAM_LIST* that we want to modify. It is prepared. */
-  t->template = safe_strdup(templ);
+  t->template = safe_strdup (templ);
 
   /* Find highest match number in template string */
   t->nmatch = 0;
 
   /* Find highest match number in template string */
   t->nmatch = 0;
-  for (p = templ; *p;)
-  {
-    if (*p == '%')
-    {
-        n = atoi(++p);
-        if (n > t->nmatch)
-          t->nmatch = n;
-        while (*p && isdigit((int)*p))
-          ++p;
+  for (p = templ; *p;) {
+    if (*p == '%') {
+      n = atoi (++p);
+      if (n > t->nmatch)
+        t->nmatch = n;
+      while (*p && isdigit ((int) *p))
+        ++p;
     }
     else
     }
     else
-        ++p;
+      ++p;
   }
   }
-  t->nmatch++;         /* match 0 is always the whole expr */
+  t->nmatch++;                  /* match 0 is always the whole expr */
 
   return 0;
 }
 
 
   return 0;
 }
 
-static int remove_from_spam_list (SPAM_LIST **list, const char *pat)
+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;
 {
   SPAM_LIST *spam, *prev;
   int nremoved = 0;
 
   /* Being first is a special case. */
   spam = *list;
-  if (spam->rx && !mutt_strcmp(spam->rx->pattern, pat))
-  {
+  if (spam->rx && !mutt_strcmp (spam->rx->pattern, pat)) {
     *list = spam->next;
     *list = spam->next;
-    mutt_free_regexp(&spam->rx);
-    safe_free(&spam->template);
-    safe_free(&spam);
+    rx_free (&spam->rx);
+    FREE(&spam->template);
+    FREE(&spam);
     return 1;
   }
 
   prev = spam;
     return 1;
   }
 
   prev = spam;
-  for (spam = prev->next; spam;)
-  {
-    if (!mutt_strcmp(spam->rx->pattern, pat))
-    {
+  for (spam = prev->next; spam;) {
+    if (!mutt_strcmp (spam->rx->pattern, pat)) {
       prev->next = spam->next;
       prev->next = spam->next;
-      mutt_free_regexp(&spam->rx);
-      safe_free(&spam->template);
-      safe_free(&spam);
+      rx_free (&spam->rx);
+      FREE(spam->template);
+      FREE(spam);
       spam = prev->next;
       ++nremoved;
     }
       spam = prev->next;
       ++nremoved;
     }
@@ -472,74 +422,124 @@ static int remove_from_spam_list (SPAM_LIST **list, const char *pat)
 }
 
 
 }
 
 
-static void remove_from_list (LIST **l, const char *str)
+static void remove_from_list (LIST ** l, const char *str)
 {
   LIST *p, *last = NULL;
 
   if (mutt_strcmp ("*", str) == 0)
 {
   LIST *p, *last = NULL;
 
   if (mutt_strcmp ("*", str) == 0)
-    mutt_free_list (l);    /* ``unCMD *'' means delete all current entries */
-  else
-  {
+    mutt_free_list (l);         /* ``unCMD *'' means delete all current entries */
+  else {
     p = *l;
     last = NULL;
     p = *l;
     last = NULL;
-    while (p)
-    {
-      if (ascii_strcasecmp (str, p->data) == 0)
-      {
-       FREE (&p->data);
-       if (last)
-         last->next = p->next;
-       else
-         (*l) = p->next;
-       FREE (&p);
+    while (p) {
+      if (ascii_strcasecmp (str, p->data) == 0) {
+        FREE (&p->data);
+        if (last)
+          last->next = p->next;
+        else
+          (*l) = p->next;
+        FREE (&p);
       }
       }
-      else
-      {
-       last = p;
-       p = p->next;
+      else {
+        last = p;
+        p = p->next;
       }
     }
   }
 }
 
       }
     }
   }
 }
 
-static void remove_from_rx_list (RX_LIST **l, const char *str)
+static int remove_from_rx_list (list2_t** l, const char *str)
 {
 {
-  RX_LIST *p, *last = NULL;
+  int i = 0;
+
+  if (mutt_strcmp ("*", str) == 0) {
+    list_del (l, 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);
+}
 
 
-  if (mutt_strcmp ("*", str) == 0)
-    mutt_free_rx_list (l);    /* ``unCMD *'' means delete all current entries */
-  else
-  {
-    p = *l;
-    last = NULL;
-    while (p)
-    {
-      if (ascii_strcasecmp (str, p->rx->pattern) == 0)
-      {
-       mutt_free_regexp (&p->rx);
-       if (last)
-         last->next = p->next;
-       else
-         (*l) = p->next;
-       FREE (&p);
-      }
-      else
-      {
-       last = p;
-       p = p->next;
+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, mutt_strlen (tmp->data))
+            && (mutt_strlen (b[j].name) == mutt_strlen (tmp->data))) {
+          res = 1;
+          break;
+        }
+    }
+  /* check for feature_* */
+  if (!res) {
+    char *p = NULL;
+
+    i = 0;
+    j = mutt_strlen (tmp->data);
+    /* need at least input of 'feature_X' */
+    if (j >= 7) {
+      p = tmp->data + 7;
+      j -= 7;
+      while (Features[i].name) {
+        if (mutt_strlen (Features[i].name) == j &&
+            ascii_strncasecmp (Features[i].name, p, j)) {
+          res = 1;
+          break;
+        }
+        i++;
       }
     }
   }
       }
     }
   }
+
+  if (!MoreArgs (s)) {
+    if (data)
+      snprintf (err->data, err->dsize, _("ifdef: too few arguments"));
+    else
+      snprintf (err->data, err->dsize, _("ifndef: too few arguments"));
+    return (-1);
+  }
+  mutt_extract_token (tmp, s, M_TOKEN_SPACE);
+
+  if ((data && res) || (!data && !res)) {
+    if (mutt_parse_rc_line (tmp->data, &token, err) == -1) {
+      mutt_error ("Error: %s", err->data);
+      FREE (&token.data);
+      return (-1);
+    }
+    FREE (&token.data);
+  }
+  return 0;
 }
 
 }
 
-static int parse_unignore (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
+static int parse_unignore (BUFFER * buf, BUFFER * s, unsigned long data,
+                           BUFFER * err)
 {
 {
-  do
-  {
+  do {
     mutt_extract_token (buf, s, 0);
 
     /* don't add "*" to the unignore list */
     mutt_extract_token (buf, s, 0);
 
     /* don't add "*" to the unignore list */
-    if (strcmp (buf->data, "*")) 
+    if (strcmp (buf->data, "*"))
       add_to_list (&UnIgnore, buf->data);
 
     remove_from_list (&Ignore, buf->data);
       add_to_list (&UnIgnore, buf->data);
 
     remove_from_list (&Ignore, buf->data);
@@ -549,10 +549,10 @@ static int parse_unignore (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *e
   return 0;
 }
 
   return 0;
 }
 
-static int parse_ignore (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
+static int parse_ignore (BUFFER * buf, BUFFER * s, unsigned long data,
+                         BUFFER * err)
 {
 {
-  do
-  {
+  do {
     mutt_extract_token (buf, s, 0);
     remove_from_list (&UnIgnore, buf->data);
     add_to_list (&Ignore, buf->data);
     mutt_extract_token (buf, s, 0);
     remove_from_list (&UnIgnore, buf->data);
     add_to_list (&Ignore, buf->data);
@@ -562,10 +562,10 @@ static int parse_ignore (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err
   return 0;
 }
 
   return 0;
 }
 
-static int parse_list (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
+static int parse_list (BUFFER * buf, BUFFER * s, unsigned long data,
+                       BUFFER * err)
 {
 {
-  do
-  {
+  do {
     mutt_extract_token (buf, s, 0);
     add_to_list ((LIST **) data, buf->data);
   }
     mutt_extract_token (buf, s, 0);
     add_to_list ((LIST **) data, buf->data);
   }
@@ -574,77 +574,63 @@ static int parse_list (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
   return 0;
 }
 
   return 0;
 }
 
-static int _parse_rx_list (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err, int flags)
+static void _alternates_clean (void)
 {
 {
-  do 
-  {
-    mutt_extract_token (buf, s, 0);
-    if (add_to_rx_list ((RX_LIST **) data, buf->data, flags, err) != 0)
-      return -1;
-       
-  }
-  while (MoreArgs (s));
-  
-  return 0;
-}
+  int i;
 
 
-static int parse_rx_list (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
-{
-  return _parse_rx_list (buf, s, data, err, REG_ICASE);
+  if (Context && Context->msgcount) {
+    for (i = 0; i < Context->msgcount; i++)
+      Context->hdrs[i]->recip_valid = 0;
+  }
 }
 
 }
 
-static int parse_rx_unlist (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
+static int parse_alternates (BUFFER * buf, BUFFER * s, unsigned long data,
+                             BUFFER * err)
 {
 {
-  do
-  {
+  _alternates_clean ();
+  do {
     mutt_extract_token (buf, s, 0);
     mutt_extract_token (buf, s, 0);
-    if (mutt_strcmp (buf->data, "*") == 0)
-    {
-      mutt_free_rx_list ((RX_LIST **) data);
-      break;
-    }
-    remove_from_rx_list ((RX_LIST **) data, buf->data);
+    remove_from_rx_list (&UnAlternates, buf->data);
+
+    if (add_to_rx_list (&Alternates, buf->data, REG_ICASE, err) != 0)
+      return -1;
   }
   while (MoreArgs (s));
   }
   while (MoreArgs (s));
-  
+
   return 0;
 }
 
   return 0;
 }
 
-static void _alternates_clean (void)
+static int parse_unalternates (BUFFER * buf, BUFFER * s, unsigned long data,
+                               BUFFER * err)
 {
 {
-  int i;
-  if (Context && Context->msgcount) 
-  {
-    for (i = 0; i < Context->msgcount; i++)
-      Context->hdrs[i]->recip_valid = 0;
-  }
-}
+  _alternates_clean ();
+  do {
+    mutt_extract_token (buf, s, 0);
+    remove_from_rx_list (&Alternates, buf->data);
 
 
-static int parse_alternates (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
-{
-  _alternates_clean();
-  return parse_rx_list (buf, s, data, err);
-}
+    if (mutt_strcmp (buf->data, "*") &&
+        add_to_rx_list (&UnAlternates, buf->data, REG_ICASE, err) != 0)
+      return -1;
 
 
-static int parse_unalternates (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
-{
-  _alternates_clean();
-  return parse_rx_unlist (buf, s, data, err);
+  }
+  while (MoreArgs (s));
+
+  return 0;
 }
 
 }
 
-static int parse_spam_list (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
+static int parse_spam_list (BUFFER * buf, BUFFER * s, unsigned long data,
+                            BUFFER * err)
 {
   BUFFER templ;
 
 {
   BUFFER templ;
 
-  memset(&templ, 0, sizeof(templ));
+  memset (&templ, 0, sizeof (templ));
 
   /* Insist on at least one parameter */
 
   /* Insist on at least one parameter */
-  if (!MoreArgs(s))
-  {
+  if (!MoreArgs (s)) {
     if (data == M_SPAM)
     if (data == M_SPAM)
-      strfcpy(err->data, _("spam: no matching pattern"), err->dsize);
+      strfcpy (err->data, _("spam: no matching pattern"), err->dsize);
     else
     else
-      strfcpy(err->data, _("nospam: no matching pattern"), err->dsize);
+      strfcpy (err->data, _("nospam: no matching pattern"), err->dsize);
     return -1;
   }
 
     return -1;
   }
 
@@ -652,45 +638,40 @@ static int parse_spam_list (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *
   mutt_extract_token (buf, s, 0);
 
   /* data should be either M_SPAM or M_NOSPAM. M_SPAM is for spam commands. */
   mutt_extract_token (buf, s, 0);
 
   /* data should be either M_SPAM or M_NOSPAM. M_SPAM is for spam commands. */
-  if (data == M_SPAM)
-  {
+  if (data == M_SPAM) {
     /* If there's a second parameter, it's a template for the spam tag. */
     /* If there's a second parameter, it's a template for the spam tag. */
-    if (MoreArgs(s))
-    {
+    if (MoreArgs (s)) {
       mutt_extract_token (&templ, s, 0);
 
       /* Add to the spam list. */
       if (add_to_spam_list (&SpamList, buf->data, templ.data, err) != 0) {
       mutt_extract_token (&templ, s, 0);
 
       /* Add to the spam list. */
       if (add_to_spam_list (&SpamList, buf->data, templ.data, err) != 0) {
-         FREE(&templ.data);
-          return -1;
+        FREE (&templ.data);
+        return -1;
       }
       }
-      FREE(&templ.data);
+      FREE (&templ.data);
     }
 
     /* If not, try to remove from the nospam list. */
     }
 
     /* If not, try to remove from the nospam list. */
-    else
-    {
-      remove_from_rx_list(&NoSpamList, buf->data);
+    else {
+      remove_from_rx_list (&NoSpamList, buf->data);
     }
 
     return 0;
   }
 
   /* M_NOSPAM is for nospam commands. */
     }
 
     return 0;
   }
 
   /* M_NOSPAM is for nospam commands. */
-  else if (data == M_NOSPAM)
-  {
+  else if (data == M_NOSPAM) {
     /* nospam only ever has one parameter. */
 
     /* "*" is a special case. */
     /* nospam only ever has one parameter. */
 
     /* "*" is a special case. */
-    if (!mutt_strcmp(buf->data, "*"))
-    {
+    if (!mutt_strcmp (buf->data, "*")) {
       mutt_free_spam_list (&SpamList);
       mutt_free_spam_list (&SpamList);
-      mutt_free_rx_list (&NoSpamList);
+      list_del (&NoSpamList, rx_free);
       return 0;
     }
 
     /* If it's on the spam list, just remove it. */
       return 0;
     }
 
     /* If it's on the spam list, just remove it. */
-    if (remove_from_spam_list(&SpamList, buf->data) != 0)
+    if (remove_from_spam_list (&SpamList, buf->data) != 0)
       return 0;
 
     /* Otherwise, add it to the nospam list. */
       return 0;
 
     /* Otherwise, add it to the nospam list. */
@@ -701,20 +682,19 @@ static int parse_spam_list (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *
   }
 
   /* This should not happen. */
   }
 
   /* This should not happen. */
-  strfcpy(err->data, "This is no good at all.", err->dsize);
+  strfcpy (err->data, "This is no good at all.", err->dsize);
   return -1;
 }
 
   return -1;
 }
 
-static int parse_unlist (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
+static int parse_unlist (BUFFER * buf, BUFFER * s, unsigned long data,
+                         BUFFER * err)
 {
 {
-  do
-  {
+  do {
     mutt_extract_token (buf, s, 0);
     /*
      * Check for deletion of entire list
      */
     mutt_extract_token (buf, s, 0);
     /*
      * Check for deletion of entire list
      */
-    if (mutt_strcmp (buf->data, "*") == 0)
-    {
+    if (mutt_strcmp (buf->data, "*") == 0) {
       mutt_free_list ((LIST **) data);
       break;
     }
       mutt_free_list ((LIST **) data);
       break;
     }
@@ -725,25 +705,46 @@ static int parse_unlist (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err
   return 0;
 }
 
   return 0;
 }
 
+static int parse_lists (BUFFER * buf, BUFFER * s, unsigned long data,
+                        BUFFER * err)
+{
+  do {
+    mutt_extract_token (buf, s, 0);
+    remove_from_rx_list (&UnMailLists, buf->data);
+
+    if (add_to_rx_list (&MailLists, buf->data, REG_ICASE, err) != 0)
+      return -1;
+  }
+  while (MoreArgs (s));
+
+  return 0;
+}
 
 
-static int parse_unlists (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
+static int parse_unlists (BUFFER * buf, BUFFER * s, unsigned long data,
+                          BUFFER * err)
 {
 {
-  do
-  {
+  do {
     mutt_extract_token (buf, s, 0);
     mutt_extract_token (buf, s, 0);
-    remove_from_rx_list (&MailLists, buf->data);
     remove_from_rx_list (&SubscribedLists, buf->data);
     remove_from_rx_list (&SubscribedLists, buf->data);
+    remove_from_rx_list (&MailLists, buf->data);
+
+    if (mutt_strcmp (buf->data, "*") &&
+        add_to_rx_list (&UnMailLists, buf->data, REG_ICASE, err) != 0)
+      return -1;
   }
   while (MoreArgs (s));
 
   return 0;
 }
 
   }
   while (MoreArgs (s));
 
   return 0;
 }
 
-static int parse_subscribe (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
+static int parse_subscribe (BUFFER * buf, BUFFER * s, unsigned long data,
+                            BUFFER * err)
 {
 {
-  do
-  {
+  do {
     mutt_extract_token (buf, s, 0);
     mutt_extract_token (buf, s, 0);
+    remove_from_rx_list (&UnMailLists, buf->data);
+    remove_from_rx_list (&UnSubscribedLists, buf->data);
+
     if (add_to_rx_list (&MailLists, buf->data, REG_ICASE, err) != 0)
       return -1;
     if (add_to_rx_list (&SubscribedLists, buf->data, REG_ICASE, err) != 0)
     if (add_to_rx_list (&MailLists, buf->data, REG_ICASE, err) != 0)
       return -1;
     if (add_to_rx_list (&SubscribedLists, buf->data, REG_ICASE, err) != 0)
@@ -753,81 +754,89 @@ static int parse_subscribe (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *
 
   return 0;
 }
 
   return 0;
 }
-  
-static int parse_unalias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
+
+static int parse_unsubscribe (BUFFER * buf, BUFFER * s, unsigned long data,
+                              BUFFER * err)
+{
+  do {
+    mutt_extract_token (buf, s, 0);
+    remove_from_rx_list (&SubscribedLists, buf->data);
+
+    if (mutt_strcmp (buf->data, "*") &&
+        add_to_rx_list (&UnSubscribedLists, buf->data, REG_ICASE, err) != 0)
+      return -1;
+  }
+  while (MoreArgs (s));
+
+  return 0;
+}
+
+static int parse_unalias (BUFFER * buf, BUFFER * s, unsigned long data,
+                          BUFFER * err)
 {
   ALIAS *tmp, *last = NULL;
 
 {
   ALIAS *tmp, *last = NULL;
 
-  do
-  {
+  do {
     mutt_extract_token (buf, s, 0);
 
     mutt_extract_token (buf, s, 0);
 
-    if (mutt_strcmp ("*", buf->data) == 0)
-    {
-      if (CurrentMenu == MENU_ALIAS)
-      {
-       for (tmp = Aliases; tmp ; tmp = tmp->next)
-         tmp->del = 1;
-       set_option (OPTFORCEREDRAWINDEX);
+    if (mutt_strcmp ("*", buf->data) == 0) {
+      if (CurrentMenu == MENU_ALIAS) {
+        for (tmp = Aliases; tmp; tmp = tmp->next)
+          tmp->del = 1;
+        set_option (OPTFORCEREDRAWINDEX);
       }
       else
       }
       else
-       mutt_free_alias (&Aliases);
+        mutt_free_alias (&Aliases);
       break;
     }
     else
       break;
     }
     else
-      for (tmp = Aliases; tmp; tmp = tmp->next)
-      {
-       if (mutt_strcasecmp (buf->data, tmp->name) == 0)
-       {
-         if (CurrentMenu == MENU_ALIAS)
-         {
-           tmp->del = 1;
-           set_option (OPTFORCEREDRAWINDEX);
-           break;
-         }
-
-         if (last)
-           last->next = tmp->next;
-         else
-           Aliases = tmp->next;
-         tmp->next = NULL;
-         mutt_free_alias (&tmp);
-         break;
-       }
-       last = tmp;
+      for (tmp = Aliases; tmp; tmp = tmp->next) {
+        if (mutt_strcasecmp (buf->data, tmp->name) == 0) {
+          if (CurrentMenu == MENU_ALIAS) {
+            tmp->del = 1;
+            set_option (OPTFORCEREDRAWINDEX);
+            break;
+          }
+
+          if (last)
+            last->next = tmp->next;
+          else
+            Aliases = tmp->next;
+          tmp->next = NULL;
+          mutt_free_alias (&tmp);
+          break;
+        }
+        last = tmp;
       }
   }
   while (MoreArgs (s));
   return 0;
 }
 
       }
   }
   while (MoreArgs (s));
   return 0;
 }
 
-static int parse_alias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
+static int parse_alias (BUFFER * buf, BUFFER * s, unsigned long data,
+                        BUFFER * err)
 {
   ALIAS *tmp = Aliases;
   ALIAS *last = NULL;
   char *estr = NULL;
 {
   ALIAS *tmp = Aliases;
   ALIAS *last = NULL;
   char *estr = NULL;
-  
-  if (!MoreArgs (s))
-  {
+
+  if (!MoreArgs (s)) {
     strfcpy (err->data, _("alias: no address"), err->dsize);
     return (-1);
   }
 
   mutt_extract_token (buf, s, 0);
 
     strfcpy (err->data, _("alias: no address"), err->dsize);
     return (-1);
   }
 
   mutt_extract_token (buf, s, 0);
 
-  dprint (2, (debugfile, "parse_alias: First token is '%s'.\n",
-             buf->data));
+  dprint (2, (debugfile, "parse_alias: First token is '%s'.\n", buf->data));
 
   /* check to see if an alias with this name already exists */
 
   /* check to see if an alias with this name already exists */
-  for (; tmp; tmp = tmp->next)
-  {
+  for (; tmp; tmp = tmp->next) {
     if (!mutt_strcasecmp (tmp->name, buf->data))
       break;
     last = tmp;
   }
 
     if (!mutt_strcasecmp (tmp->name, buf->data))
       break;
     last = tmp;
   }
 
-  if (!tmp)
-  {
+  if (!tmp) {
     /* create a new alias */
     tmp = (ALIAS *) safe_calloc (1, sizeof (ALIAS));
     tmp->self = tmp;
     /* create a new alias */
     tmp = (ALIAS *) safe_calloc (1, sizeof (ALIAS));
     tmp->self = tmp;
@@ -836,40 +845,35 @@ static int parse_alias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
     if (CurrentMenu == MENU_ALIAS)
       set_option (OPTMENUCALLER);
   }
     if (CurrentMenu == MENU_ALIAS)
       set_option (OPTMENUCALLER);
   }
-  else
-  {
+  else {
     /* override the previous value */
     rfc822_free_address (&tmp->addr);
     if (CurrentMenu == MENU_ALIAS)
       set_option (OPTFORCEREDRAWINDEX);
   }
 
     /* override the previous value */
     rfc822_free_address (&tmp->addr);
     if (CurrentMenu == MENU_ALIAS)
       set_option (OPTFORCEREDRAWINDEX);
   }
 
-  mutt_extract_token (buf, s, M_TOKEN_QUOTE | M_TOKEN_SPACE | M_TOKEN_SEMICOLON);
-  dprint (2, (debugfile, "parse_alias: Second token is '%s'.\n",
-             buf->data));
+  mutt_extract_token (buf, s,
+                      M_TOKEN_QUOTE | M_TOKEN_SPACE | M_TOKEN_SEMICOLON);
+  dprint (2, (debugfile, "parse_alias: Second token is '%s'.\n", buf->data));
   tmp->addr = mutt_parse_adrlist (tmp->addr, buf->data);
   if (last)
     last->next = tmp;
   else
     Aliases = tmp;
   tmp->addr = mutt_parse_adrlist (tmp->addr, buf->data);
   if (last)
     last->next = tmp;
   else
     Aliases = tmp;
-  if (mutt_addrlist_to_idna (tmp->addr, &estr))
-  {
-    snprintf (err->data, err->dsize, _("Warning: Bad IDN '%s' in alias '%s'.\n"),
-             estr, tmp->name);
+  if (mutt_addrlist_to_idna (tmp->addr, &estr)) {
+    snprintf (err->data, err->dsize,
+              _("Warning: Bad IDN '%s' in alias '%s'.\n"), estr, tmp->name);
     return -1;
   }
 #ifdef DEBUG
     return -1;
   }
 #ifdef DEBUG
-  if (debuglevel >= 2) 
-  {
+  if (debuglevel >= 2) {
     ADDRESS *a;
     ADDRESS *a;
-    for (a = tmp->addr; a; a = a->next)
-    {
+
+    for (a = tmp->addr; a; a = a->next) {
       if (!a->group)
       if (!a->group)
-       dprint (2, (debugfile, "parse_alias:   %s\n",
-                   a->mailbox));
+        dprint (2, (debugfile, "parse_alias:   %s\n", a->mailbox));
       else
       else
-       dprint (2, (debugfile, "parse_alias:   Group %s\n",
-                   a->mailbox));
+        dprint (2, (debugfile, "parse_alias:   Group %s\n", a->mailbox));
     }
   }
 #endif
     }
   }
 #endif
@@ -877,45 +881,41 @@ static int parse_alias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
 }
 
 static int
 }
 
 static int
-parse_unmy_hdr (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
+parse_unmy_hdr (BUFFER * buf, BUFFER * s, unsigned long data, BUFFER * err)
 {
   LIST *last = NULL;
   LIST *tmp = UserHeader;
   LIST *ptr;
   size_t l;
 
 {
   LIST *last = NULL;
   LIST *tmp = UserHeader;
   LIST *ptr;
   size_t l;
 
-  do
-  {
+  do {
     mutt_extract_token (buf, s, 0);
     if (mutt_strcmp ("*", buf->data) == 0)
       mutt_free_list (&UserHeader);
     mutt_extract_token (buf, s, 0);
     if (mutt_strcmp ("*", buf->data) == 0)
       mutt_free_list (&UserHeader);
-    else
-    {
+    else {
       tmp = UserHeader;
       last = NULL;
 
       l = mutt_strlen (buf->data);
       if (buf->data[l - 1] == ':')
       tmp = UserHeader;
       last = NULL;
 
       l = mutt_strlen (buf->data);
       if (buf->data[l - 1] == ':')
-       l--;
-
-      while (tmp)
-      {
-       if (ascii_strncasecmp (buf->data, tmp->data, l) == 0 && tmp->data[l] == ':')
-       {
-         ptr = tmp;
-         if (last)
-           last->next = tmp->next;
-         else
-           UserHeader = tmp->next;
-         tmp = tmp->next;
-         ptr->next = NULL;
-         mutt_free_list (&ptr);
-       }
-       else
-       {
-         last = tmp;
-         tmp = tmp->next;
-       }
+        l--;
+
+      while (tmp) {
+        if (ascii_strncasecmp (buf->data, tmp->data, l) == 0
+            && tmp->data[l] == ':') {
+          ptr = tmp;
+          if (last)
+            last->next = tmp->next;
+          else
+            UserHeader = tmp->next;
+          tmp = tmp->next;
+          ptr->next = NULL;
+          mutt_free_list (&ptr);
+        }
+        else {
+          last = tmp;
+          tmp = tmp->next;
+        }
       }
     }
   }
       }
     }
   }
@@ -923,41 +923,37 @@ parse_unmy_hdr (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
   return 0;
 }
 
   return 0;
 }
 
-static int parse_my_hdr (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
+static int parse_my_hdr (BUFFER * buf, BUFFER * s, unsigned long data,
+                         BUFFER * err)
 {
   LIST *tmp;
   size_t keylen;
   char *p;
 
   mutt_extract_token (buf, s, M_TOKEN_SPACE | M_TOKEN_QUOTE);
 {
   LIST *tmp;
   size_t keylen;
   char *p;
 
   mutt_extract_token (buf, s, M_TOKEN_SPACE | M_TOKEN_QUOTE);
-  if ((p = strpbrk (buf->data, ": \t")) == NULL || *p != ':')
-  {
+  if ((p = strpbrk (buf->data, ": \t")) == NULL || *p != ':') {
     strfcpy (err->data, _("invalid header field"), err->dsize);
     return (-1);
   }
   keylen = p - buf->data + 1;
 
     strfcpy (err->data, _("invalid header field"), err->dsize);
     return (-1);
   }
   keylen = p - buf->data + 1;
 
-  if (UserHeader)
-  {
-    for (tmp = UserHeader; ; tmp = tmp->next)
-    {
+  if (UserHeader) {
+    for (tmp = UserHeader;; tmp = tmp->next) {
       /* see if there is already a field by this name */
       /* see if there is already a field by this name */
-      if (ascii_strncasecmp (buf->data, tmp->data, keylen) == 0)
-      {
-       /* replace the old value */
-       FREE (&tmp->data);
-       tmp->data = buf->data;
-       memset (buf, 0, sizeof (BUFFER));
-       return 0;
+      if (ascii_strncasecmp (buf->data, tmp->data, keylen) == 0) {
+        /* replace the old value */
+        FREE (&tmp->data);
+        tmp->data = buf->data;
+        memset (buf, 0, sizeof (BUFFER));
+        return 0;
       }
       if (!tmp->next)
       }
       if (!tmp->next)
-       break;
+        break;
     }
     tmp->next = mutt_new_list ();
     tmp = tmp->next;
   }
     }
     tmp->next = mutt_new_list ();
     tmp = tmp->next;
   }
-  else
-  {
+  else {
     tmp = mutt_new_list ();
     UserHeader = tmp;
   }
     tmp = mutt_new_list ();
     UserHeader = tmp;
   }
@@ -967,24 +963,22 @@ static int parse_my_hdr (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err
 }
 
 static int
 }
 
 static int
-parse_sort (short *val, const char *s, const struct mapping_t *map, BUFFER *err)
+parse_sort (short *val, const char *s, const struct mapping_t *map,
+            BUFFER * err)
 {
   int i, flags = 0;
 
 {
   int i, flags = 0;
 
-  if (mutt_strncmp ("reverse-", s, 8) == 0)
-  {
+  if (mutt_strncmp ("reverse-", s, 8) == 0) {
     s += 8;
     flags = SORT_REVERSE;
   }
     s += 8;
     flags = SORT_REVERSE;
   }
-  
-  if (mutt_strncmp ("last-", s, 5) == 0)
-  {
+
+  if (mutt_strncmp ("last-", s, 5) == 0) {
     s += 5;
     flags |= SORT_LAST;
   }
 
     s += 5;
     flags |= SORT_LAST;
   }
 
-  if ((i = mutt_getvaluebyname (s, map)) == -1)
-  {
+  if ((i = mutt_getvaluebyname (s, map)) == -1) {
     snprintf (err->data, err->dsize, _("%s: unknown sorting method"), s);
     return (-1);
   }
     snprintf (err->data, err->dsize, _("%s: unknown sorting method"), s);
     return (-1);
   }
@@ -996,34 +990,34 @@ parse_sort (short *val, const char *s, const struct mapping_t *map, BUFFER *err)
 
 static void mutt_set_default (struct option_t *p)
 {
 
 static void mutt_set_default (struct option_t *p)
 {
-  switch (p->type & DT_MASK)
-  {
-    case DT_STR:
-      if (!p->init && *((char **) p->data))
-        p->init = (unsigned long) safe_strdup (* ((char **) p->data));
-      break;
-    case DT_PATH:
-      if (!p->init && *((char **) p->data))
-      {
-       char *cp = safe_strdup (*((char **) p->data));
-       /* mutt_pretty_mailbox (cp); */
-        p->init = (unsigned long) cp;
-      }
-      break;
-    case DT_ADDR:
-      if (!p->init && *((ADDRESS **) p->data))
-      {
-       char tmp[HUGE_STRING];
-       *tmp = '\0';
-       rfc822_write_address (tmp, sizeof (tmp), *((ADDRESS **) p->data), 0);
-       p->init = (unsigned long) safe_strdup (tmp);
-      }
-      break;
-    case DT_RX:
+  switch (p->type & DT_MASK) {
+  case DT_STR:
+    if (!p->init && *((char **) p->data))
+      p->init = (unsigned long) safe_strdup (*((char **) p->data));
+    break;
+  case DT_PATH:
+    if (!p->init && *((char **) p->data)) {
+      char *cp = safe_strdup (*((char **) p->data));
+
+      /* mutt_pretty_mailbox (cp); */
+      p->init = (unsigned long) cp;
+    }
+    break;
+  case DT_ADDR:
+    if (!p->init && *((ADDRESS **) p->data)) {
+      char tmp[HUGE_STRING];
+
+      *tmp = '\0';
+      rfc822_write_address (tmp, sizeof (tmp), *((ADDRESS **) p->data), 0);
+      p->init = (unsigned long) safe_strdup (tmp);
+    }
+    break;
+  case DT_RX:
     {
     {
-      REGEXP *pp = (REGEXP *) p->data;
+      rx_t* pp = (rx_t*) p->data;
+
       if (!p->init && pp->pattern)
       if (!p->init && pp->pattern)
-       p->init = (unsigned long) safe_strdup (pp->pattern);
+        p->init = (unsigned long) safe_strdup (pp->pattern);
       break;
     }
   }
       break;
     }
   }
@@ -1031,78 +1025,74 @@ static void mutt_set_default (struct option_t *p)
 
 static void mutt_restore_default (struct option_t *p)
 {
 
 static void mutt_restore_default (struct option_t *p)
 {
-  switch (p->type & DT_MASK)
-  {
-    case DT_STR:
-      if (p->init)
-       mutt_str_replace ((char **) p->data, (char *) p->init); 
-      break;
-    case DT_PATH:
-      if (p->init)
-      {
-       char path[_POSIX_PATH_MAX];
-
-       strfcpy (path, (char *) p->init, sizeof (path));
-       mutt_expand_path (path, sizeof (path));
-       mutt_str_replace ((char **) p->data, path);
-      }
-      break;
-    case DT_ADDR:
-      if (p->init)
-      {
-       rfc822_free_address ((ADDRESS **) p->data);
-       *((ADDRESS **) p->data) = rfc822_parse_adrlist (NULL, (char *) p->init);
+  switch (p->type & DT_MASK) {
+  case DT_STR:
+    if (p->init)
+      mutt_str_replace ((char **) p->data, (char *) p->init);
+    break;
+  case DT_PATH:
+    if (p->init) {
+      char path[_POSIX_PATH_MAX];
+
+      strfcpy (path, (char *) p->init, sizeof (path));
+      mutt_expand_path (path, sizeof (path));
+      mutt_str_replace ((char **) p->data, path);
+    }
+    break;
+  case DT_ADDR:
+    if (p->init) {
+      rfc822_free_address ((ADDRESS **) p->data);
+      *((ADDRESS **) p->data) = rfc822_parse_adrlist (NULL, (char *) p->init);
+    }
+    break;
+  case DT_BOOL:
+    if (p->init)
+      set_option (p->data);
+    else
+      unset_option (p->data);
+    break;
+  case DT_QUAD:
+    set_quadoption (p->data, p->init);
+    break;
+  case DT_NUM:
+  case DT_SORT:
+  case DT_MAGIC:
+    *((short *) p->data) = p->init;
+    break;
+  case DT_RX:
+    {
+      rx_t *pp = (rx_t *) p->data;
+      int flags = 0;
+
+      FREE (&pp->pattern);
+      if (pp->rx) {
+        regfree (pp->rx);
+        FREE (&pp->rx);
       }
       }
-      break;
-    case DT_BOOL:
-      if (p->init)
-       set_option (p->data);
-      else
-       unset_option (p->data);
-      break;
-    case DT_QUAD:
-      set_quadoption (p->data, p->init);
-      break;
-    case DT_NUM:
-    case DT_SORT:
-    case DT_MAGIC:
-      *((short *) p->data) = p->init;
-      break;
-    case DT_RX:
-      {
-       REGEXP *pp = (REGEXP *) p->data;
-       int flags = 0;
-
-       FREE (&pp->pattern);
-       if (pp->rx)
-       {
-         regfree (pp->rx);
-         FREE (&pp->rx);
-       }
-
-       if (p->init)
-       {
-         char *s = (char *) p->init;
-
-         pp->rx = safe_calloc (1, sizeof (regex_t));
-         if (mutt_strcmp (p->option, "mask") != 0)
-           flags |= mutt_which_case ((const char *) p->init);
-         if (mutt_strcmp (p->option, "mask") == 0 && *s == '!')
-         {
-           s++;
-           pp->not = 1;
-         }
-         if (REGCOMP (pp->rx, s, flags) != 0)
-         {
-           fprintf (stderr, _("mutt_restore_default(%s): error in regexp: %s\n"),
-                    p->option, pp->pattern);
-           FREE (&pp->pattern);
-           regfree (pp->rx);
-           FREE (&pp->rx);
-         }
-       }
+
+      if (p->init) {
+        char *s = (char *) p->init;
+
+        pp->rx = safe_calloc (1, sizeof (regex_t));
+        if (mutt_strcmp (p->option, "mask") != 0)
+          flags |= mutt_which_case ((const char *) p->init);
+        if (mutt_strcmp (p->option, "mask") == 0 && *s == '!') {
+          s++;
+          pp->not = 1;
+        }
+        if (REGCOMP (pp->rx, s, flags) != 0) {
+          fprintf (stderr,
+                   _("mutt_restore_default(%s): error in regexp: %s\n"),
+                   p->option, pp->pattern);
+          FREE (&pp->pattern);
+          regfree (pp->rx);
+          FREE (&pp->rx);
+        }
+        else
+          mutt_str_replace (&pp->pattern, (char *) p->init);
       }
       }
-      break;
+    }
+    break;
   }
 
   if (p->flags & R_INDEX)
   }
 
   if (p->flags & R_INDEX)
@@ -1119,36 +1109,32 @@ static void mutt_restore_default (struct option_t *p)
     set_option (OPTREDRAWTREE);
 }
 
     set_option (OPTREDRAWTREE);
 }
 
-static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
+static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
+                      BUFFER * err)
 {
   int idx, query, unset, inv, reset, r = 0;
   char *p, scratch[_POSIX_PATH_MAX];
 
 {
   int idx, query, unset, inv, reset, r = 0;
   char *p, scratch[_POSIX_PATH_MAX];
 
-  while (MoreArgs (s))
-  {
+  while (MoreArgs (s)) {
     /* reset state variables */
     query = 0;
     unset = data & M_SET_UNSET;
     inv = data & M_SET_INV;
     reset = data & M_SET_RESET;
 
     /* reset state variables */
     query = 0;
     unset = data & M_SET_UNSET;
     inv = data & M_SET_INV;
     reset = data & M_SET_RESET;
 
-    if (*s->dptr == '?')
-    {
+    if (*s->dptr == '?') {
       query = 1;
       s->dptr++;
     }
       query = 1;
       s->dptr++;
     }
-    else if (mutt_strncmp ("no", s->dptr, 2) == 0)
-    {
+    else if (mutt_strncmp ("no", s->dptr, 2) == 0) {
       s->dptr += 2;
       unset = !unset;
     }
       s->dptr += 2;
       unset = !unset;
     }
-    else if (mutt_strncmp ("inv", s->dptr, 3) == 0)
-    {
+    else if (mutt_strncmp ("inv", s->dptr, 3) == 0) {
       s->dptr += 3;
       inv = !inv;
     }
       s->dptr += 3;
       inv = !inv;
     }
-    else if (*s->dptr == '&')
-    {
+    else if (*s->dptr == '&') {
       reset = 1;
       s->dptr++;
     }
       reset = 1;
       s->dptr++;
     }
@@ -1157,268 +1143,238 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
     mutt_extract_token (tmp, s, M_TOKEN_EQUAL);
 
     if ((idx = mutt_option_index (tmp->data)) == -1 &&
     mutt_extract_token (tmp, s, M_TOKEN_EQUAL);
 
     if ((idx = mutt_option_index (tmp->data)) == -1 &&
-       !(reset && !mutt_strcmp ("all", tmp->data)))
-    {
+        !(reset && !mutt_strcmp ("all", tmp->data))) {
       snprintf (err->data, err->dsize, _("%s: unknown variable"), tmp->data);
       return (-1);
     }
     SKIPWS (s->dptr);
 
       snprintf (err->data, err->dsize, _("%s: unknown variable"), tmp->data);
       return (-1);
     }
     SKIPWS (s->dptr);
 
-    if (reset)
-    {
-      if (query || unset || inv)
-      {
-       snprintf (err->data, err->dsize, _("prefix is illegal with reset"));
-       return (-1);
+    if (reset) {
+      if (query || unset || inv) {
+        snprintf (err->data, err->dsize, _("prefix is illegal with reset"));
+        return (-1);
       }
 
       }
 
-      if (s && *s->dptr == '=')
-      {
-       snprintf (err->data, err->dsize, _("value is illegal with reset"));
-       return (-1);
+      if (s && *s->dptr == '=') {
+        snprintf (err->data, err->dsize, _("value is illegal with reset"));
+        return (-1);
       }
       }
-     
-      if (!mutt_strcmp ("all", tmp->data))
-      {
-       for (idx = 0; MuttVars[idx].option; idx++)
-         mutt_restore_default (&MuttVars[idx]);
-       return 0;
+
+      if (!mutt_strcmp ("all", tmp->data)) {
+        for (idx = 0; MuttVars[idx].option; idx++)
+          mutt_restore_default (&MuttVars[idx]);
+        return 0;
       }
       else
       }
       else
-       mutt_restore_default (&MuttVars[idx]);
-    } 
-    else if (DTYPE (MuttVars[idx].type) == DT_BOOL)
-    { 
-      if (s && *s->dptr == '=')
-      {
-       if (unset || inv || query)
-       {
-         snprintf (err->data, err->dsize, "Usage: set variable=yes|no");
-         return (-1);
-       }
-
-       s->dptr++;
-       mutt_extract_token (tmp, s, 0);
-       if (ascii_strcasecmp ("yes", tmp->data) == 0)
-         unset = inv = 0;
-       else if (ascii_strcasecmp ("no", tmp->data) == 0)
-         unset = 1;
-       else
-       {
-         snprintf (err->data, err->dsize, "Usage: set variable=yes|no");
-         return (-1);
-       }
+        mutt_restore_default (&MuttVars[idx]);
+    }
+    else if (DTYPE (MuttVars[idx].type) == DT_BOOL) {
+      if (s && *s->dptr == '=') {
+        if (unset || inv || query) {
+          snprintf (err->data, err->dsize, "Usage: set variable=yes|no");
+          return (-1);
+        }
+
+        s->dptr++;
+        mutt_extract_token (tmp, s, 0);
+        if (ascii_strcasecmp ("yes", tmp->data) == 0)
+          unset = inv = 0;
+        else if (ascii_strcasecmp ("no", tmp->data) == 0)
+          unset = 1;
+        else {
+          snprintf (err->data, err->dsize, "Usage: set variable=yes|no");
+          return (-1);
+        }
       }
 
       }
 
-      if (query)
-      {
-       snprintf (err->data, err->dsize, option (MuttVars[idx].data)
-                       ? _("%s is set") : _("%s is unset"), tmp->data);
-       return 0;
+      if (query) {
+        snprintf (err->data, err->dsize, option (MuttVars[idx].data)
+                  ? _("%s is set") : _("%s is unset"), tmp->data);
+        return 0;
       }
 
       if (unset)
       }
 
       if (unset)
-       unset_option (MuttVars[idx].data);
+        unset_option (MuttVars[idx].data);
       else if (inv)
       else if (inv)
-       toggle_option (MuttVars[idx].data);
+        toggle_option (MuttVars[idx].data);
       else
       else
-       set_option (MuttVars[idx].data);
+        set_option (MuttVars[idx].data);
     }
     else if (DTYPE (MuttVars[idx].type) == DT_STR ||
     }
     else if (DTYPE (MuttVars[idx].type) == DT_STR ||
-            DTYPE (MuttVars[idx].type) == DT_PATH ||
-            DTYPE (MuttVars[idx].type) == DT_ADDR)
-    {
-      if (unset)
-      {
-       if (DTYPE (MuttVars[idx].type) == DT_ADDR)
-         rfc822_free_address ((ADDRESS **) MuttVars[idx].data);
-       else
-         FREE ((void *)MuttVars[idx].data);
+             DTYPE (MuttVars[idx].type) == DT_PATH ||
+             DTYPE (MuttVars[idx].type) == DT_ADDR) {
+      if (unset) {
+        if (DTYPE (MuttVars[idx].type) == DT_ADDR)
+          rfc822_free_address ((ADDRESS **) MuttVars[idx].data);
+        else
+          FREE ((void *) MuttVars[idx].data);
       }
       }
-      else if (query || *s->dptr != '=')
-      {
-       char _tmp[STRING];
-       char *val = NULL;
-       
-       if (DTYPE (MuttVars[idx].type) == DT_ADDR)
-       {
-         _tmp[0] = '\0';
-         rfc822_write_address (_tmp, sizeof (_tmp), *((ADDRESS **) MuttVars[idx].data), 0);
-         val = _tmp;
-       }
-       else
-         val = *((char **) MuttVars[idx].data);
-       
-       /* user requested the value of this variable */
-       snprintf (err->data, err->dsize, "%s=\"%s\"", MuttVars[idx].option,
-                 NONULL (val));
-       break;
+      else if (query || *s->dptr != '=') {
+        char _tmp[STRING];
+        char *val = NULL;
+
+        if (DTYPE (MuttVars[idx].type) == DT_ADDR) {
+          _tmp[0] = '\0';
+          rfc822_write_address (_tmp, sizeof (_tmp),
+                                *((ADDRESS **) MuttVars[idx].data), 0);
+          val = _tmp;
+        }
+        else
+          val = *((char **) MuttVars[idx].data);
+
+        /* user requested the value of this variable */
+        snprintf (err->data, err->dsize, "%s=\"%s\"", MuttVars[idx].option,
+                  NONULL (val));
+        break;
       }
       }
-      else
-      {
+      else {
         s->dptr++;
 
         /* copy the value of the string */
         if (DTYPE (MuttVars[idx].type) == DT_ADDR)
         s->dptr++;
 
         /* copy the value of the string */
         if (DTYPE (MuttVars[idx].type) == DT_ADDR)
-         rfc822_free_address ((ADDRESS **) MuttVars[idx].data);
+          rfc822_free_address ((ADDRESS **) MuttVars[idx].data);
         else
         else
-         FREE ((void *)MuttVars[idx].data);
+          FREE ((void *) MuttVars[idx].data);
 
         mutt_extract_token (tmp, s, 0);
 
         mutt_extract_token (tmp, s, 0);
-        if (DTYPE (MuttVars[idx].type) == DT_PATH)
-        {
-         strfcpy (scratch, tmp->data, sizeof (scratch));
-         mutt_expand_path (scratch, sizeof (scratch));
-         *((char **) MuttVars[idx].data) = safe_strdup (scratch);
+        if (DTYPE (MuttVars[idx].type) == DT_PATH) {
+          strfcpy (scratch, tmp->data, sizeof (scratch));
+          mutt_expand_path (scratch, sizeof (scratch));
+          *((char **) MuttVars[idx].data) = safe_strdup (scratch);
         }
         }
-        else if (DTYPE (MuttVars[idx].type) == DT_STR)
-        {
-         *((char **) MuttVars[idx].data) = safe_strdup (tmp->data);
-         if (mutt_strcmp (MuttVars[idx].option, "charset") == 0)
-           mutt_set_charset (Charset);
+        else if (DTYPE (MuttVars[idx].type) == DT_STR) {
+          *((char **) MuttVars[idx].data) = safe_strdup (tmp->data);
+          if (mutt_strcmp (MuttVars[idx].option, "charset") == 0)
+            mutt_set_charset (Charset);
         }
         }
-        else
-        {
-         *((ADDRESS **) MuttVars[idx].data) = rfc822_parse_adrlist (NULL, tmp->data);
+        else {
+          *((ADDRESS **) MuttVars[idx].data) =
+            rfc822_parse_adrlist (NULL, tmp->data);
         }
       }
     }
         }
       }
     }
-    else if (DTYPE(MuttVars[idx].type) == DT_RX)
-    {
-      REGEXP *ptr = (REGEXP *) MuttVars[idx].data;
+    else if (DTYPE (MuttVars[idx].type) == DT_RX) {
+      rx_t *ptr = (rx_t *) MuttVars[idx].data;
       regex_t *rx;
       int e, flags = 0;
 
       regex_t *rx;
       int e, flags = 0;
 
-      if (query || *s->dptr != '=')
-      {
-       /* user requested the value of this variable */
-       snprintf (err->data, err->dsize, "%s=\"%s\"", MuttVars[idx].option,
-                 NONULL (ptr->pattern));
-       break;
+      if (query || *s->dptr != '=') {
+        /* user requested the value of this variable */
+        snprintf (err->data, err->dsize, "%s=\"%s\"", MuttVars[idx].option,
+                  NONULL (ptr->pattern));
+        break;
       }
 
       }
 
-      if (option(OPTATTACHMSG) && !mutt_strcmp(MuttVars[idx].option, "reply_regexp"))
-      {
-       snprintf (err->data, err->dsize, "Operation not permitted when in attach-message mode.");
-       r = -1;
-       break;
+      if (option (OPTATTACHMSG)
+          && !mutt_strcmp (MuttVars[idx].option, "reply_regexp")) {
+        snprintf (err->data, err->dsize,
+                  "Operation not permitted when in attach-message mode.");
+        r = -1;
+        break;
       }
       }
-      
+
       s->dptr++;
 
       /* copy the value of the string */
       mutt_extract_token (tmp, s, 0);
 
       s->dptr++;
 
       /* copy the value of the string */
       mutt_extract_token (tmp, s, 0);
 
-      if (!ptr->pattern || mutt_strcmp (ptr->pattern, tmp->data) != 0)
-      {
-       int not = 0;
-
-       /* $mask is case-sensitive */
-       if (mutt_strcmp (MuttVars[idx].option, "mask") != 0)
-         flags |= mutt_which_case (tmp->data);
-
-       p = tmp->data;
-       if (mutt_strcmp (MuttVars[idx].option, "mask") == 0)
-       {
-         if (*p == '!')
-         {
-           not = 1;
-           p++;
-         }
-       }
-         
-       rx = (regex_t *) safe_malloc (sizeof (regex_t));
-       if ((e = REGCOMP (rx, p, flags)) != 0)
-       {
-         regerror (e, rx, err->data, err->dsize);
-         regfree (rx);
-         FREE (&rx);
-         break;
-       }
-
-       /* get here only if everything went smootly */
-       if (ptr->pattern)
-       {
-         FREE (&ptr->pattern);
-         regfree ((regex_t *) ptr->rx);
-         FREE (&ptr->rx);
-       }
-
-       ptr->pattern = safe_strdup (tmp->data);
-       ptr->rx = rx;
-       ptr->not = not;
-
-       /* $reply_regexp and $alterantes require special treatment */
-       
-       if (Context && Context->msgcount &&
-           mutt_strcmp (MuttVars[idx].option, "reply_regexp") == 0)
-       {
-         regmatch_t pmatch[1];
-         int i;
-         
+      if (!ptr->pattern || mutt_strcmp (ptr->pattern, tmp->data) != 0) {
+        int not = 0;
+
+        /* $mask is case-sensitive */
+        if (mutt_strcmp (MuttVars[idx].option, "mask") != 0)
+          flags |= mutt_which_case (tmp->data);
+
+        p = tmp->data;
+        if (mutt_strcmp (MuttVars[idx].option, "mask") == 0) {
+          if (*p == '!') {
+            not = 1;
+            p++;
+          }
+        }
+
+        rx = (regex_t *) safe_malloc (sizeof (regex_t));
+        if ((e = REGCOMP (rx, p, flags)) != 0) {
+          regerror (e, rx, err->data, err->dsize);
+          regfree (rx);
+          FREE (&rx);
+          break;
+        }
+
+        /* get here only if everything went smootly */
+        if (ptr->pattern) {
+          FREE (&ptr->pattern);
+          regfree ((regex_t *) ptr->rx);
+          FREE (&ptr->rx);
+        }
+
+        ptr->pattern = safe_strdup (tmp->data);
+        ptr->rx = rx;
+        ptr->not = not;
+
+        /* $reply_regexp and $alterantes require special treatment */
+
+        if (Context && Context->msgcount &&
+            mutt_strcmp (MuttVars[idx].option, "reply_regexp") == 0) {
+          regmatch_t pmatch[1];
+          int i;
+
 #define CUR_ENV Context->hdrs[i]->env
 #define CUR_ENV Context->hdrs[i]->env
-         for (i = 0; i < Context->msgcount; i++)
-         {
-           if (CUR_ENV && CUR_ENV->subject)
-           {
-             CUR_ENV->real_subj = (regexec (ReplyRegexp.rx,
-                                   CUR_ENV->subject, 1, pmatch, 0)) ?
-                                   CUR_ENV->subject : 
-                                   CUR_ENV->subject + pmatch[0].rm_eo;
-           }
-         }
+          for (i = 0; i < Context->msgcount; i++) {
+            if (CUR_ENV && CUR_ENV->subject) {
+              CUR_ENV->real_subj = (regexec (ReplyRegexp.rx,
+                                             CUR_ENV->subject, 1, pmatch,
+                                             0)) ? CUR_ENV->
+                subject : CUR_ENV->subject + pmatch[0].rm_eo;
+            }
+          }
 #undef CUR_ENV
 #undef CUR_ENV
-       }
+        }
       }
     }
       }
     }
-    else if (DTYPE(MuttVars[idx].type) == DT_MAGIC)
-    {
-      if (query || *s->dptr != '=')
-      {
-       switch (DefaultMagic)
-       {
-         case M_MBOX:
-           p = "mbox";
-           break;
-         case M_MMDF:
-           p = "MMDF";
-           break;
-         case M_MH:
-           p = "MH";
-           break;
-         case M_MAILDIR:
-           p = "Maildir";
-           break;
-         default:
-           p = "unknown";
-           break;
-       }
-       snprintf (err->data, err->dsize, "%s=%s", MuttVars[idx].option, p);
-       break;
+    else if (DTYPE (MuttVars[idx].type) == DT_MAGIC) {
+      if (query || *s->dptr != '=') {
+        switch (DefaultMagic) {
+        case M_MBOX:
+          p = "mbox";
+          break;
+        case M_MMDF:
+          p = "MMDF";
+          break;
+        case M_MH:
+          p = "MH";
+          break;
+        case M_MAILDIR:
+          p = "Maildir";
+          break;
+        default:
+          p = "unknown";
+          break;
+        }
+        snprintf (err->data, err->dsize, "%s=%s", MuttVars[idx].option, p);
+        break;
       }
 
       s->dptr++;
 
       /* copy the value of the string */
       mutt_extract_token (tmp, s, 0);
       }
 
       s->dptr++;
 
       /* copy the value of the string */
       mutt_extract_token (tmp, s, 0);
-      if (mx_set_magic (tmp->data))
-      {
-       snprintf (err->data, err->dsize, _("%s: invalid mailbox type"), tmp->data);
-       r = -1;
-       break;
+      if (mx_set_magic (tmp->data)) {
+        snprintf (err->data, err->dsize, _("%s: invalid mailbox type"),
+                  tmp->data);
+        r = -1;
+        break;
       }
     }
       }
     }
-    else if (DTYPE(MuttVars[idx].type) == DT_NUM)
-    {
+    else if (DTYPE (MuttVars[idx].type) == DT_NUM) {
       short *ptr = (short *) MuttVars[idx].data;
       int val;
       char *t;
 
       short *ptr = (short *) MuttVars[idx].data;
       int val;
       char *t;
 
-      if (query || *s->dptr != '=')
-      {
-       /* user requested the value of this variable */
-       snprintf (err->data, err->dsize, "%s=%d", MuttVars[idx].option, *ptr);
-       break;
+      if (query || *s->dptr != '=') {
+        /* user requested the value of this variable */
+        snprintf (err->data, err->dsize, "%s=%d", MuttVars[idx].option, *ptr);
+        break;
       }
 
       s->dptr++;
       }
 
       s->dptr++;
@@ -1426,121 +1382,113 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
       mutt_extract_token (tmp, s, 0);
       val = strtol (tmp->data, &t, 0);
 
       mutt_extract_token (tmp, s, 0);
       val = strtol (tmp->data, &t, 0);
 
-      if (!*tmp->data || *t || (short) val != val)
-      {
-       snprintf (err->data, err->dsize, _("%s: invalid value"), tmp->data);
-       r = -1;
-       break;
+      if (!*tmp->data || *t || (short) val != val) {
+        snprintf (err->data, err->dsize, _("%s: invalid value"), tmp->data);
+        r = -1;
+        break;
       }
       else
       }
       else
-       *ptr = (short) val;
+        *ptr = (short) val;
 
       /* these ones need a sanity check */
 
       /* these ones need a sanity check */
-      if (mutt_strcmp (MuttVars[idx].option, "history") == 0)
-      {
-       if (*ptr < 0)
-         *ptr = 0;
-       mutt_init_history ();
+      if (mutt_strcmp (MuttVars[idx].option, "history") == 0) {
+        if (*ptr < 0)
+          *ptr = 0;
+        mutt_init_history ();
       }
       }
-      else if (mutt_strcmp (MuttVars[idx].option, "pager_index_lines") == 0)
-      {
-       if (*ptr < 0)
-         *ptr = 0;
+      else if (mutt_strcmp (MuttVars[idx].option, "pager_index_lines") == 0) {
+        if (*ptr < 0)
+          *ptr = 0;
       }
     }
       }
     }
-    else if (DTYPE (MuttVars[idx].type) == DT_QUAD)
-    {
-      if (query)
-      {
-       char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
+    else if (DTYPE (MuttVars[idx].type) == DT_QUAD) {
+      if (query) {
+        char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
 
 
-       snprintf (err->data, err->dsize, "%s=%s", MuttVars[idx].option,
-                 vals [ quadoption (MuttVars[idx].data) ]);
-       break;
+        snprintf (err->data, err->dsize, "%s=%s", MuttVars[idx].option,
+                  vals[quadoption (MuttVars[idx].data)]);
+        break;
       }
 
       }
 
-      if (*s->dptr == '=')
-      {
-       s->dptr++;
-       mutt_extract_token (tmp, s, 0);
-       if (ascii_strcasecmp ("yes", tmp->data) == 0)
-         set_quadoption (MuttVars[idx].data, M_YES);
-       else if (ascii_strcasecmp ("no", tmp->data) == 0)
-         set_quadoption (MuttVars[idx].data, M_NO);
-       else if (ascii_strcasecmp ("ask-yes", tmp->data) == 0)
-         set_quadoption (MuttVars[idx].data, M_ASKYES);
-       else if (ascii_strcasecmp ("ask-no", tmp->data) == 0)
-         set_quadoption (MuttVars[idx].data, M_ASKNO);
-       else
-       {
-         snprintf (err->data, err->dsize, _("%s: invalid value"), tmp->data);
-         r = -1;
-         break;
-       }
+      if (*s->dptr == '=') {
+        s->dptr++;
+        mutt_extract_token (tmp, s, 0);
+        if (ascii_strcasecmp ("yes", tmp->data) == 0)
+          set_quadoption (MuttVars[idx].data, M_YES);
+        else if (ascii_strcasecmp ("no", tmp->data) == 0)
+          set_quadoption (MuttVars[idx].data, M_NO);
+        else if (ascii_strcasecmp ("ask-yes", tmp->data) == 0)
+          set_quadoption (MuttVars[idx].data, M_ASKYES);
+        else if (ascii_strcasecmp ("ask-no", tmp->data) == 0)
+          set_quadoption (MuttVars[idx].data, M_ASKNO);
+        else {
+          snprintf (err->data, err->dsize, _("%s: invalid value"), tmp->data);
+          r = -1;
+          break;
+        }
       }
       }
-      else
-      {
-       if (inv)
-         toggle_quadoption (MuttVars[idx].data);
-       else if (unset)
-         set_quadoption (MuttVars[idx].data, M_NO);
-       else
-         set_quadoption (MuttVars[idx].data, M_YES);
+      else {
+        if (inv)
+          toggle_quadoption (MuttVars[idx].data);
+        else if (unset)
+          set_quadoption (MuttVars[idx].data, M_NO);
+        else
+          set_quadoption (MuttVars[idx].data, M_YES);
       }
     }
       }
     }
-    else if (DTYPE (MuttVars[idx].type) == DT_SORT)
-    {
+    else if (DTYPE (MuttVars[idx].type) == DT_SORT) {
       const struct mapping_t *map = NULL;
 
       const struct mapping_t *map = NULL;
 
-      switch (MuttVars[idx].type & DT_SUBTYPE_MASK)
-      {
-       case DT_SORT_ALIAS:
-         map = SortAliasMethods;
-         break;
-       case DT_SORT_BROWSER:
-         map = SortBrowserMethods;
-         break;
-       case DT_SORT_KEYS:
-          if ((WithCrypto & APPLICATION_PGP))
-            map = SortKeyMethods;
-         break;
-       case DT_SORT_AUX:
-         map = SortAuxMethods;
-         break;
-       default:
-         map = SortMethods;
-         break;
+      switch (MuttVars[idx].type & DT_SUBTYPE_MASK) {
+      case DT_SORT_ALIAS:
+        map = SortAliasMethods;
+        break;
+      case DT_SORT_BROWSER:
+        map = SortBrowserMethods;
+        break;
+      case DT_SORT_KEYS:
+        if ((WithCrypto & APPLICATION_PGP))
+          map = SortKeyMethods;
+        break;
+      case DT_SORT_AUX:
+        map = SortAuxMethods;
+        break;
+      default:
+        map = SortMethods;
+        break;
       }
 
       }
 
-      if (!map)
-      {
-       snprintf (err->data, err->dsize, _("%s: Unknown type."), MuttVars[idx].option);
-       r = -1;
-       break;
+      if (!map) {
+        snprintf (err->data, err->dsize, _("%s: Unknown type."),
+                  MuttVars[idx].option);
+        r = -1;
+        break;
       }
       }
-      
-      if (query || *s->dptr != '=')
-      {
-       p = mutt_getnamebyvalue (*((short *) MuttVars[idx].data) & SORT_MASK, map);
-
-       snprintf (err->data, err->dsize, "%s=%s%s%s", MuttVars[idx].option,
-                 (*((short *) MuttVars[idx].data) & SORT_REVERSE) ? "reverse-" : "",
-                 (*((short *) MuttVars[idx].data) & SORT_LAST) ? "last-" : "",
-                 p);
-       return 0;
+
+      if (query || *s->dptr != '=') {
+        p =
+          mutt_getnamebyvalue (*((short *) MuttVars[idx].data) & SORT_MASK,
+                               map);
+
+        snprintf (err->data, err->dsize, "%s=%s%s%s", MuttVars[idx].option,
+                  (*((short *) MuttVars[idx].data) & SORT_REVERSE) ?
+                  "reverse-" : "",
+                  (*((short *) MuttVars[idx].data) & SORT_LAST) ? "last-" :
+                  "", p);
+        return 0;
       }
       s->dptr++;
       }
       s->dptr++;
-      mutt_extract_token (tmp, s , 0);
+      mutt_extract_token (tmp, s, 0);
 
 
-      if (parse_sort ((short *) MuttVars[idx].data, tmp->data, map, err) == -1)
-      {
-       r = -1;
-       break;
+      if (parse_sort ((short *) MuttVars[idx].data, tmp->data, map, err) ==
+          -1) {
+        r = -1;
+        break;
       }
     }
       }
     }
-    else
-    {
-      snprintf (err->data, err->dsize, _("%s: unknown type"), MuttVars[idx].option);
+    else {
+      snprintf (err->data, err->dsize, _("%s: unknown type"),
+                MuttVars[idx].option);
       r = -1;
       break;
     }
       r = -1;
       break;
     }
@@ -1565,7 +1513,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
 
 /* reads the specified initialization file.  returns -1 if errors were found
    so that we can pause to let the user know...  */
 
 /* reads the specified initialization file.  returns -1 if errors were found
    so that we can pause to let the user know...  */
-static int source_rc (const char *rcfile, BUFFER *err)
+static int source_rc (const char *rcfile, BUFFER * err)
 {
   FILE *f;
   int line = 0, rc = 0, conv = 0;
 {
   FILE *f;
   int line = 0, rc = 0, conv = 0;
@@ -1575,55 +1523,51 @@ static int source_rc (const char *rcfile, BUFFER *err)
   size_t buflen;
   pid_t pid;
 
   size_t buflen;
   pid_t pid;
 
-  dprint (2, (debugfile, "Reading configuration file '%s'.\n",
-         rcfile));
-  
-  if ((f = mutt_open_read (rcfile, &pid)) == NULL)
-  {
+  dprint (2, (debugfile, "Reading configuration file '%s'.\n", rcfile));
+
+  if ((f = mutt_open_read (rcfile, &pid)) == NULL) {
     snprintf (err->data, err->dsize, "%s: %s", rcfile, strerror (errno));
     return (-1);
   }
 
   memset (&token, 0, sizeof (token));
     snprintf (err->data, err->dsize, "%s: %s", rcfile, strerror (errno));
     return (-1);
   }
 
   memset (&token, 0, sizeof (token));
-  while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line)) != NULL)
-  {
-    conv=ConfigCharset && (*ConfigCharset) && Charset;
-    if (conv) 
-    {
-      currentline=safe_strdup(linebuf);
-      if (!currentline) continue;
-      mutt_convert_string(&currentline, ConfigCharset, Charset, 0);
-    } 
-    else 
-      currentline=linebuf;
-
-    if (mutt_parse_rc_line (currentline, &token, err) == -1)
-    {
+  while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line)) != NULL) {
+    conv = ConfigCharset && (*ConfigCharset) && Charset;
+    if (conv) {
+      currentline = safe_strdup (linebuf);
+      if (!currentline)
+        continue;
+      mutt_convert_string (&currentline, ConfigCharset, Charset, 0);
+    }
+    else
+      currentline = linebuf;
+
+    if (mutt_parse_rc_line (currentline, &token, err) == -1) {
       mutt_error (_("Error in %s, line %d: %s"), rcfile, line, err->data);
       mutt_error (_("Error in %s, line %d: %s"), rcfile, line, err->data);
-      if (--rc < -MAXERRS) 
-      {
-        if (conv) FREE(&currentline);
+      if (--rc < -MAXERRS) {
+        if (conv)
+          FREE (&currentline);
         break;
       }
     }
         break;
       }
     }
-    else
-    {
+    else {
       if (rc < 0)
         rc = -1;
     }
     if (conv)
       if (rc < 0)
         rc = -1;
     }
     if (conv)
-      FREE(&currentline);
+      FREE (&currentline);
   }
   FREE (&token.data);
   FREE (&linebuf);
   fclose (f);
   if (pid != -1)
     mutt_wait_filter (pid);
   }
   FREE (&token.data);
   FREE (&linebuf);
   fclose (f);
   if (pid != -1)
     mutt_wait_filter (pid);
-  if (rc)
-  {
+  if (rc) {
     /* the muttrc source keyword */
     /* the muttrc source keyword */
-    snprintf (err->data, err->dsize, rc >= -MAXERRS ? _("source: errors in %s")
-      : _("source: reading aborted due too many errors in %s"), rcfile);
+    snprintf (err->data, err->dsize,
+              rc >= -MAXERRS ? _("source: errors in %s")
+              : _("source: reading aborted due too many errors in %s"),
+              rcfile);
     rc = -1;
   }
   return (rc);
     rc = -1;
   }
   return (rc);
@@ -1631,15 +1575,14 @@ static int source_rc (const char *rcfile, BUFFER *err)
 
 #undef MAXERRS
 
 
 #undef MAXERRS
 
-static int parse_source (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
+static int parse_source (BUFFER * tmp, BUFFER * s, unsigned long data,
+                         BUFFER * err)
 {
   char path[_POSIX_PATH_MAX];
   int rc = 0;
 
 {
   char path[_POSIX_PATH_MAX];
   int rc = 0;
 
-  do
-  {
-    if (mutt_extract_token (tmp, s, 0) != 0)
-    {
+  do {
+    if (mutt_extract_token (tmp, s, 0) != 0) {
       snprintf (err->data, err->dsize, _("source: error at %s"), s->dptr);
       return (-1);
     }
       snprintf (err->data, err->dsize, _("source: error at %s"), s->dptr);
       return (-1);
     }
@@ -1664,7 +1607,7 @@ static int parse_source (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err
                every call to this function.
 
    err         where to write error messages */
                every call to this function.
 
    err         where to write error messages */
-int mutt_parse_rc_line (/* const */ char *line, BUFFER *token, BUFFER *err)
+int mutt_parse_rc_line ( /* const */ char *line, BUFFER * token, BUFFER * err)
 {
   int i, r = -1;
   BUFFER expn;
 {
   int i, r = -1;
   BUFFER expn;
@@ -1676,28 +1619,24 @@ int mutt_parse_rc_line (/* const */ char *line, BUFFER *token, BUFFER *err)
   *err->data = 0;
 
   SKIPWS (expn.dptr);
   *err->data = 0;
 
   SKIPWS (expn.dptr);
-  while (*expn.dptr)
-  {
+  while (*expn.dptr) {
     if (*expn.dptr == '#')
     if (*expn.dptr == '#')
-      break; /* rest of line is a comment */
-    if (*expn.dptr == ';')
-    {
+      break;                    /* rest of line is a comment */
+    if (*expn.dptr == ';') {
       expn.dptr++;
       continue;
     }
     mutt_extract_token (token, &expn, 0);
       expn.dptr++;
       continue;
     }
     mutt_extract_token (token, &expn, 0);
-    for (i = 0; Commands[i].name; i++)
-    {
-      if (!mutt_strcmp (token->data, Commands[i].name))
-      {
-       if (Commands[i].func (token, &expn, Commands[i].data, err) != 0)
-         goto finish;
+    for (i = 0; Commands[i].name; i++) {
+      if (!mutt_strcmp (token->data, Commands[i].name)) {
+        if (Commands[i].func (token, &expn, Commands[i].data, err) != 0)
+          goto finish;
         break;
       }
     }
         break;
       }
     }
-    if (!Commands[i].name)
-    {
-      snprintf (err->data, err->dsize, _("%s: unknown command"), NONULL (token->data));
+    if (!Commands[i].name) {
+      snprintf (err->data, err->dsize, _("%s: unknown command"),
+                NONULL (token->data));
       goto finish;
     }
   }
       goto finish;
     }
   }
@@ -1713,11 +1652,11 @@ finish:
 #define NUMCOMMANDS (sizeof (Commands)/sizeof (Commands[0]))
 /* initial string that starts completion. No telling how much crap 
  * the user has typed so far. Allocate LONG_STRING just to be sure! */
 #define NUMCOMMANDS (sizeof (Commands)/sizeof (Commands[0]))
 /* initial string that starts completion. No telling how much crap 
  * the user has typed so far. Allocate LONG_STRING just to be sure! */
-char User_typed [LONG_STRING] = {0}; 
+char User_typed[LONG_STRING] = { 0 };
 
 
-int  Num_matched = 0; /* Number of matches for completion */
-char Completed [STRING] = {0}; /* completed string (command or variable) */
-char *Matches[MAX(NUMVARS,NUMCOMMANDS) + 1]; /* all the matches + User_typed */
+int Num_matched = 0;            /* Number of matches for completion */
+char Completed[STRING] = { 0 }; /* completed string (command or variable) */
+char *Matches[MAX (NUMVARS, NUMCOMMANDS) + 1];  /* all the matches + User_typed */
 
 /* helper function for completion.  Changes the dest buffer if
    necessary/possible to aid completion.
 
 /* helper function for completion.  Changes the dest buffer if
    necessary/possible to aid completion.
@@ -1730,13 +1669,11 @@ static void candidate (char *dest, char *try, char *src, int len)
 {
   int l;
 
 {
   int l;
 
-  if (strstr (src, try) == src)
-  {
+  if (strstr (src, try) == src) {
     Matches[Num_matched++] = src;
     if (dest[0] == 0)
       strfcpy (dest, src, len);
     Matches[Num_matched++] = src;
     if (dest[0] == 0)
       strfcpy (dest, src, len);
-    else
-    {
+    else {
       for (l = 0; src[l] && src[l] == dest[l]; l++);
       dest[l] = 0;
     }
       for (l = 0; src[l] && src[l] == dest[l]; l++);
       dest[l] = 0;
     }
@@ -1747,7 +1684,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
 {
   char *pt = buffer;
   int num;
 {
   char *pt = buffer;
   int num;
-  int spaces; /* keep track of the number of leading spaces on the line */
+  int spaces;                   /* keep track of the number of leading spaces on the line */
 
   SKIPWS (buffer);
   spaces = buffer - pt;
 
   SKIPWS (buffer);
   spaces = buffer - pt;
@@ -1756,76 +1693,71 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
   while ((pt > buffer) && !isspace ((unsigned char) *pt))
     pt--;
 
   while ((pt > buffer) && !isspace ((unsigned char) *pt))
     pt--;
 
-  if (pt == buffer) /* complete cmd */
-  {
+  if (pt == buffer) {           /* complete cmd */
     /* first TAB. Collect all the matches */
     /* first TAB. Collect all the matches */
-    if (numtabs == 1)
-    {
+    if (numtabs == 1) {
       Num_matched = 0;
       strfcpy (User_typed, pt, sizeof (User_typed));
       memset (Matches, 0, sizeof (Matches));
       memset (Completed, 0, sizeof (Completed));
       for (num = 0; Commands[num].name; num++)
       Num_matched = 0;
       strfcpy (User_typed, pt, sizeof (User_typed));
       memset (Matches, 0, sizeof (Matches));
       memset (Completed, 0, sizeof (Completed));
       for (num = 0; Commands[num].name; num++)
-       candidate (Completed, User_typed, Commands[num].name, sizeof (Completed));
+        candidate (Completed, User_typed, Commands[num].name,
+                   sizeof (Completed));
       Matches[Num_matched++] = User_typed;
 
       /* All matches are stored. Longest non-ambiguous string is ""
        * i.e. dont change 'buffer'. Fake successful return this time */
       if (User_typed[0] == 0)
       Matches[Num_matched++] = User_typed;
 
       /* All matches are stored. Longest non-ambiguous string is ""
        * i.e. dont change 'buffer'. Fake successful return this time */
       if (User_typed[0] == 0)
-       return 1;
+        return 1;
     }
 
     if (Completed[0] == 0 && User_typed[0])
       return 0;
 
     }
 
     if (Completed[0] == 0 && User_typed[0])
       return 0;
 
-     /* Num_matched will _always_ be atleast 1 since the initial
-      * user-typed string is always stored */
+    /* Num_matched will _always_ be atleast 1 since the initial
+     * user-typed string is always stored */
     if (numtabs == 1 && Num_matched == 2)
     if (numtabs == 1 && Num_matched == 2)
-      snprintf(Completed, sizeof(Completed),"%s", Matches[0]);
+      snprintf (Completed, sizeof (Completed), "%s", Matches[0]);
     else if (numtabs > 1 && Num_matched > 2)
       /* cycle thru all the matches */
     else if (numtabs > 1 && Num_matched > 2)
       /* cycle thru all the matches */
-      snprintf(Completed, sizeof(Completed), "%s", 
-              Matches[(numtabs - 2) % Num_matched]);
+      snprintf (Completed, sizeof (Completed), "%s",
+                Matches[(numtabs - 2) % Num_matched]);
 
     /* return the completed command */
     strncpy (buffer, Completed, len - spaces);
   }
   else if (!mutt_strncmp (buffer, "set", 3)
 
     /* return the completed command */
     strncpy (buffer, Completed, len - spaces);
   }
   else if (!mutt_strncmp (buffer, "set", 3)
-          || !mutt_strncmp (buffer, "unset", 5)
-          || !mutt_strncmp (buffer, "reset", 5)
-          || !mutt_strncmp (buffer, "toggle", 6))
-  {            /* complete variables */
+           || !mutt_strncmp (buffer, "unset", 5)
+           || !mutt_strncmp (buffer, "reset", 5)
+           || !mutt_strncmp (buffer, "toggle", 6)) {    /* complete variables */
     char *prefixes[] = { "no", "inv", "?", "&", 0 };
     char *prefixes[] = { "no", "inv", "?", "&", 0 };
-    
+
     pt++;
     /* loop through all the possible prefixes (no, inv, ...) */
     pt++;
     /* loop through all the possible prefixes (no, inv, ...) */
-    if (!mutt_strncmp (buffer, "set", 3))
-    {
-      for (num = 0; prefixes[num]; num++)
-      {
-       if (!mutt_strncmp (pt, prefixes[num], mutt_strlen (prefixes[num])))
-       {
-         pt += mutt_strlen (prefixes[num]);
-         break;
-       }
+    if (!mutt_strncmp (buffer, "set", 3)) {
+      for (num = 0; prefixes[num]; num++) {
+        if (!mutt_strncmp (pt, prefixes[num], mutt_strlen (prefixes[num]))) {
+          pt += mutt_strlen (prefixes[num]);
+          break;
+        }
       }
     }
       }
     }
-    
+
     /* first TAB. Collect all the matches */
     /* first TAB. Collect all the matches */
-    if (numtabs == 1)
-    {
+    if (numtabs == 1) {
       Num_matched = 0;
       strfcpy (User_typed, pt, sizeof (User_typed));
       memset (Matches, 0, sizeof (Matches));
       memset (Completed, 0, sizeof (Completed));
       for (num = 0; MuttVars[num].option; num++)
       Num_matched = 0;
       strfcpy (User_typed, pt, sizeof (User_typed));
       memset (Matches, 0, sizeof (Matches));
       memset (Completed, 0, sizeof (Completed));
       for (num = 0; MuttVars[num].option; num++)
-       candidate (Completed, User_typed, MuttVars[num].option, sizeof (Completed));
+        candidate (Completed, User_typed, MuttVars[num].option,
+                   sizeof (Completed));
       Matches[Num_matched++] = User_typed;
 
       /* All matches are stored. Longest non-ambiguous string is ""
        * i.e. dont change 'buffer'. Fake successful return this time */
       if (User_typed[0] == 0)
       Matches[Num_matched++] = User_typed;
 
       /* All matches are stored. Longest non-ambiguous string is ""
        * i.e. dont change 'buffer'. Fake successful return this time */
       if (User_typed[0] == 0)
-       return 1;
+        return 1;
     }
 
     if (Completed[0] == 0 && User_typed[0])
     }
 
     if (Completed[0] == 0 && User_typed[0])
@@ -1834,44 +1766,42 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
     /* Num_matched will _always_ be atleast 1 since the initial
      * user-typed string is always stored */
     if (numtabs == 1 && Num_matched == 2)
     /* Num_matched will _always_ be atleast 1 since the initial
      * user-typed string is always stored */
     if (numtabs == 1 && Num_matched == 2)
-      snprintf(Completed, sizeof(Completed),"%s", Matches[0]);
+      snprintf (Completed, sizeof (Completed), "%s", Matches[0]);
     else if (numtabs > 1 && Num_matched > 2)
     else if (numtabs > 1 && Num_matched > 2)
-    /* cycle thru all the matches */
-      snprintf(Completed, sizeof(Completed), "%s", 
-              Matches[(numtabs - 2) % Num_matched]);
+      /* cycle thru all the matches */
+      snprintf (Completed, sizeof (Completed), "%s",
+                Matches[(numtabs - 2) % Num_matched]);
 
     strncpy (pt, Completed, buffer + len - pt - spaces);
   }
 
     strncpy (pt, Completed, buffer + len - pt - spaces);
   }
-  else if (!mutt_strncmp (buffer, "exec", 4))
-  {
+  else if (!mutt_strncmp (buffer, "exec", 4)) {
     struct binding_t *menu = km_get_table (CurrentMenu);
 
     if (!menu && CurrentMenu != MENU_PAGER)
       menu = OpGeneric;
     struct binding_t *menu = km_get_table (CurrentMenu);
 
     if (!menu && CurrentMenu != MENU_PAGER)
       menu = OpGeneric;
-    
+
     pt++;
     /* first TAB. Collect all the matches */
     pt++;
     /* first TAB. Collect all the matches */
-    if (numtabs == 1)
-    {
+    if (numtabs == 1) {
       Num_matched = 0;
       strfcpy (User_typed, pt, sizeof (User_typed));
       memset (Matches, 0, sizeof (Matches));
       memset (Completed, 0, sizeof (Completed));
       for (num = 0; menu[num].name; num++)
       Num_matched = 0;
       strfcpy (User_typed, pt, sizeof (User_typed));
       memset (Matches, 0, sizeof (Matches));
       memset (Completed, 0, sizeof (Completed));
       for (num = 0; menu[num].name; num++)
-       candidate (Completed, User_typed, menu[num].name, sizeof (Completed));
+        candidate (Completed, User_typed, menu[num].name, sizeof (Completed));
       /* try the generic menu */
       /* try the generic menu */
-      if (Completed[0] == 0 && CurrentMenu != MENU_PAGER) 
-      {
-       menu = OpGeneric;
-       for (num = 0; menu[num].name; num++)
-         candidate (Completed, User_typed, menu[num].name, sizeof (Completed));
+      if (Completed[0] == 0 && CurrentMenu != MENU_PAGER) {
+        menu = OpGeneric;
+        for (num = 0; menu[num].name; num++)
+          candidate (Completed, User_typed, menu[num].name,
+                     sizeof (Completed));
       }
       Matches[Num_matched++] = User_typed;
 
       /* All matches are stored. Longest non-ambiguous string is ""
        * i.e. dont change 'buffer'. Fake successful return this time */
       if (User_typed[0] == 0)
       }
       Matches[Num_matched++] = User_typed;
 
       /* All matches are stored. Longest non-ambiguous string is ""
        * i.e. dont change 'buffer'. Fake successful return this time */
       if (User_typed[0] == 0)
-       return 1;
+        return 1;
     }
 
     if (Completed[0] == 0 && User_typed[0])
     }
 
     if (Completed[0] == 0 && User_typed[0])
@@ -1880,11 +1810,11 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
     /* Num_matched will _always_ be atleast 1 since the initial
      * user-typed string is always stored */
     if (numtabs == 1 && Num_matched == 2)
     /* Num_matched will _always_ be atleast 1 since the initial
      * user-typed string is always stored */
     if (numtabs == 1 && Num_matched == 2)
-      snprintf(Completed, sizeof(Completed),"%s", Matches[0]);
+      snprintf (Completed, sizeof (Completed), "%s", Matches[0]);
     else if (numtabs > 1 && Num_matched > 2)
     else if (numtabs > 1 && Num_matched > 2)
-    /* cycle thru all the matches */
-      snprintf(Completed, sizeof(Completed), "%s", 
-              Matches[(numtabs - 2) % Num_matched]);
+      /* cycle thru all the matches */
+      snprintf (Completed, sizeof (Completed), "%s",
+                Matches[(numtabs - 2) % Num_matched]);
 
     strncpy (pt, Completed, buffer + len - pt - spaces);
   }
 
     strncpy (pt, Completed, buffer + len - pt - spaces);
   }
@@ -1898,7 +1828,7 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
 {
   char var[STRING], *pt = buffer;
   int spaces;
 {
   char var[STRING], *pt = buffer;
   int spaces;
-  
+
   if (buffer[0] == 0)
     return 0;
 
   if (buffer[0] == 0)
     return 0;
 
@@ -1908,88 +1838,87 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
   pt = buffer + pos - spaces;
   while ((pt > buffer) && !isspace ((unsigned char) *pt))
     pt--;
   pt = buffer + pos - spaces;
   while ((pt > buffer) && !isspace ((unsigned char) *pt))
     pt--;
-  pt++; /* move past the space */
-  if (*pt == '=') /* abort if no var before the '=' */
+  pt++;                         /* move past the space */
+  if (*pt == '=')               /* abort if no var before the '=' */
     return 0;
 
     return 0;
 
-  if (mutt_strncmp (buffer, "set", 3) == 0)
-  {
+  if (mutt_strncmp (buffer, "set", 3) == 0) {
     int idx;
     int idx;
+
     strfcpy (var, pt, sizeof (var));
     /* ignore the trailing '=' when comparing */
     var[mutt_strlen (var) - 1] = 0;
     strfcpy (var, pt, sizeof (var));
     /* ignore the trailing '=' when comparing */
     var[mutt_strlen (var) - 1] = 0;
-    if ((idx = mutt_option_index (var)) == -1) 
-      return 0; /* no such variable. */
-    else
-    {
-      char tmp [LONG_STRING], tmp2[LONG_STRING];
+    if ((idx = mutt_option_index (var)) == -1)
+      return 0;                 /* no such variable. */
+    else {
+      char tmp[LONG_STRING], tmp2[LONG_STRING];
       char *s, *d;
       size_t dlen = buffer + len - pt - spaces;
       char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
 
       tmp[0] = '\0';
 
       char *s, *d;
       size_t dlen = buffer + len - pt - spaces;
       char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
 
       tmp[0] = '\0';
 
-      if ((DTYPE(MuttVars[idx].type) == DT_STR) || 
-         (DTYPE(MuttVars[idx].type) == DT_PATH) ||
-         (DTYPE(MuttVars[idx].type) == DT_RX))
-      {
-       strfcpy (tmp, NONULL (*((char **) MuttVars[idx].data)), sizeof (tmp));
-       if (DTYPE (MuttVars[idx].type) == DT_PATH)
-         mutt_pretty_mailbox (tmp);
+      if ((DTYPE (MuttVars[idx].type) == DT_STR) ||
+          (DTYPE (MuttVars[idx].type) == DT_PATH) ||
+          (DTYPE (MuttVars[idx].type) == DT_RX)) {
+        strfcpy (tmp, NONULL (*((char **) MuttVars[idx].data)), sizeof (tmp));
+        if (DTYPE (MuttVars[idx].type) == DT_PATH)
+          mutt_pretty_mailbox (tmp);
       }
       }
-      else if (DTYPE (MuttVars[idx].type) == DT_ADDR)
-      {
-       rfc822_write_address (tmp, sizeof (tmp), *((ADDRESS **) MuttVars[idx].data), 0);
+      else if (DTYPE (MuttVars[idx].type) == DT_ADDR) {
+        rfc822_write_address (tmp, sizeof (tmp),
+                              *((ADDRESS **) MuttVars[idx].data), 0);
       }
       else if (DTYPE (MuttVars[idx].type) == DT_QUAD)
       }
       else if (DTYPE (MuttVars[idx].type) == DT_QUAD)
-       strfcpy (tmp, vals[quadoption (MuttVars[idx].data)], sizeof (tmp));
+        strfcpy (tmp, vals[quadoption (MuttVars[idx].data)], sizeof (tmp));
       else if (DTYPE (MuttVars[idx].type) == DT_NUM)
       else if (DTYPE (MuttVars[idx].type) == DT_NUM)
-       snprintf (tmp, sizeof (tmp), "%d", (*((short *) MuttVars[idx].data)));
-      else if (DTYPE (MuttVars[idx].type) == DT_SORT)
-      {
-       const struct mapping_t *map;
-       char *p;
-
-       switch (MuttVars[idx].type & DT_SUBTYPE_MASK)
-       {
-         case DT_SORT_ALIAS:
-           map = SortAliasMethods;
-           break;
-         case DT_SORT_BROWSER:
-           map = SortBrowserMethods;
-           break;
-         case DT_SORT_KEYS:
-            if ((WithCrypto & APPLICATION_PGP))
-              map = SortKeyMethods;
-            else
-              map = SortMethods;
-           break;
-         default:
-           map = SortMethods;
-           break;
-       }
-       p = mutt_getnamebyvalue (*((short *) MuttVars[idx].data) & SORT_MASK, map);
-       snprintf (tmp, sizeof (tmp), "%s%s%s",
-                 (*((short *) MuttVars[idx].data) & SORT_REVERSE) ? "reverse-" : "",
-                 (*((short *) MuttVars[idx].data) & SORT_LAST) ? "last-" : "",
-                 p);
+        snprintf (tmp, sizeof (tmp), "%d", (*((short *) MuttVars[idx].data)));
+      else if (DTYPE (MuttVars[idx].type) == DT_SORT) {
+        const struct mapping_t *map;
+        char *p;
+
+        switch (MuttVars[idx].type & DT_SUBTYPE_MASK) {
+        case DT_SORT_ALIAS:
+          map = SortAliasMethods;
+          break;
+        case DT_SORT_BROWSER:
+          map = SortBrowserMethods;
+          break;
+        case DT_SORT_KEYS:
+          if ((WithCrypto & APPLICATION_PGP))
+            map = SortKeyMethods;
+          else
+            map = SortMethods;
+          break;
+        default:
+          map = SortMethods;
+          break;
+        }
+        p =
+          mutt_getnamebyvalue (*((short *) MuttVars[idx].data) & SORT_MASK,
+                               map);
+        snprintf (tmp, sizeof (tmp), "%s%s%s",
+                  (*((short *) MuttVars[idx].data) & SORT_REVERSE) ?
+                  "reverse-" : "",
+                  (*((short *) MuttVars[idx].data) & SORT_LAST) ? "last-" :
+                  "", p);
       }
       else if (DTYPE (MuttVars[idx].type) == DT_BOOL)
       }
       else if (DTYPE (MuttVars[idx].type) == DT_BOOL)
-       strfcpy (tmp, option (MuttVars[idx].data) ? "yes" : "no", sizeof (tmp));
+        strfcpy (tmp, option (MuttVars[idx].data) ? "yes" : "no",
+                 sizeof (tmp));
       else
       else
-       return 0;
-      
-      for (s = tmp, d = tmp2; *s && (d - tmp2) < sizeof (tmp2) - 2;)
-      {
-       if (*s == '\\' || *s == '"')
-         *d++ = '\\';
-       *d++ = *s++;
+        return 0;
+
+      for (s = tmp, d = tmp2; *s && (d - tmp2) < sizeof (tmp2) - 2;) {
+        if (*s == '\\' || *s == '"')
+          *d++ = '\\';
+        *d++ = *s++;
       }
       *d = '\0';
       }
       *d = '\0';
-      
+
       strfcpy (tmp, pt, sizeof (tmp));
       snprintf (pt, dlen, "%s\"%s\"", tmp, tmp2);
       strfcpy (tmp, pt, sizeof (tmp));
       snprintf (pt, dlen, "%s\"%s\"", tmp, tmp2);
-         
+
       return 1;
     }
   }
       return 1;
     }
   }
@@ -1997,33 +1926,31 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
 }
 
 /* Implement the -Q command line flag */
 }
 
 /* Implement the -Q command line flag */
-int mutt_query_variables (LIST *queries)
+int mutt_query_variables (LIST * queries)
 {
   LIST *p;
 {
   LIST *p;
-  
+
   char errbuff[STRING];
   char command[STRING];
   char errbuff[STRING];
   char command[STRING];
-  
+
   BUFFER err, token;
   BUFFER err, token;
-  
+
   memset (&err, 0, sizeof (err));
   memset (&token, 0, sizeof (token));
   memset (&err, 0, sizeof (err));
   memset (&token, 0, sizeof (token));
-  
+
   err.data = errbuff;
   err.dsize = sizeof (errbuff);
   err.data = errbuff;
   err.dsize = sizeof (errbuff);
-  
-  for (p = queries; p; p = p->next)
-  {
+
+  for (p = queries; p; p = p->next) {
     snprintf (command, sizeof (command), "set ?%s\n", p->data);
     snprintf (command, sizeof (command), "set ?%s\n", p->data);
-    if (mutt_parse_rc_line (command, &token, &err) == -1)
-    {
+    if (mutt_parse_rc_line (command, &token, &err) == -1) {
       fprintf (stderr, "%s\n", err.data);
       FREE (&token.data);
       return 1;
     }
     printf ("%s\n", err.data);
   }
       fprintf (stderr, "%s\n", err.data);
       FREE (&token.data);
       return 1;
     }
     printf ("%s\n", err.data);
   }
-  
+
   FREE (&token.data);
   return 0;
 }
   FREE (&token.data);
   return 0;
 }
@@ -2032,7 +1959,7 @@ char *mutt_getnamebyvalue (int val, const struct mapping_t *map)
 {
   int i;
 
 {
   int i;
 
-  for (i=0; map[i].name; i++)
+  for (i = 0; map[i].name; i++)
     if (map[i].value == val)
       return (map[i].name);
   return NULL;
     if (map[i].value == val)
       return (map[i].name);
   return NULL;
@@ -2057,23 +1984,23 @@ static void start_debug (void)
   char buf2[_POSIX_PATH_MAX];
 
   /* rotate the old debug logs */
   char buf2[_POSIX_PATH_MAX];
 
   /* rotate the old debug logs */
-  for (i=3; i>=0; i--)
-  {
-    snprintf (buf, sizeof(buf), "%s/.muttdebug%d", NONULL(Homedir), i);
-    snprintf (buf2, sizeof(buf2), "%s/.muttdebug%d", NONULL(Homedir), i+1);
+  for (i = 3; i >= 0; i--) {
+    snprintf (buf, sizeof (buf), "%s/.muttdebug%d", NONULL (Homedir), i);
+    snprintf (buf2, sizeof (buf2), "%s/.muttdebug%d", NONULL (Homedir),
+              i + 1);
     rename (buf, buf2);
   }
     rename (buf, buf2);
   }
-  if ((debugfile = safe_fopen(buf, "w")) != NULL)
-  {
+  if ((debugfile = safe_fopen (buf, "w")) != NULL) {
     t = time (0);
     t = time (0);
-    setbuf (debugfile, NULL); /* don't buffer the debugging output! */
-    fprintf (debugfile, "Mutt %s started at %s.\nDebugging at level %d.\n\n",
-            MUTT_VERSION, asctime (localtime (&t)), debuglevel);
+    setbuf (debugfile, NULL);   /* don't buffer the debugging output! */
+    fprintf (debugfile,
+             "Mutt-ng %s started at %s.\nDebugging at level %d.\n\n",
+             MUTT_VERSION, asctime (localtime (&t)), debuglevel);
   }
 }
 #endif
 
   }
 }
 #endif
 
-static int mutt_execute_commands (LIST *p)
+static int mutt_execute_commands (LIST * p)
 {
   BUFFER err, token;
   char errstr[SHORT_STRING];
 {
   BUFFER err, token;
   char errstr[SHORT_STRING];
@@ -2082,10 +2009,8 @@ static int mutt_execute_commands (LIST *p)
   err.data = errstr;
   err.dsize = sizeof (errstr);
   memset (&token, 0, sizeof (token));
   err.data = errstr;
   err.dsize = sizeof (errstr);
   memset (&token, 0, sizeof (token));
-  for (; p; p = p->next)
-  {
-    if (mutt_parse_rc_line (p->data, &token, &err) != 0)
-    {
+  for (; p; p = p->next) {
+    if (mutt_parse_rc_line (p->data, &token, &err) != 0) {
       fprintf (stderr, _("Error in command line: %s\n"), err.data);
       FREE (&token.data);
       return (-1);
       fprintf (stderr, _("Error in command line: %s\n"), err.data);
       FREE (&token.data);
       return (-1);
@@ -2095,7 +2020,7 @@ static int mutt_execute_commands (LIST *p)
   return 0;
 }
 
   return 0;
 }
 
-void mutt_init (int skip_sys_rc, LIST *commands)
+void mutt_init (int skip_sys_rc, LIST * commands)
 {
   struct passwd *pw;
   struct utsname utsname;
 {
   struct passwd *pw;
   struct utsname utsname;
@@ -2111,16 +2036,15 @@ void mutt_init (int skip_sys_rc, LIST *commands)
    * XXX - use something even more difficult to predict?
    */
   snprintf (AttachmentMarker, sizeof (AttachmentMarker),
    * XXX - use something even more difficult to predict?
    */
   snprintf (AttachmentMarker, sizeof (AttachmentMarker),
-           "\033]9;%ld\a", (long) time (NULL));
-  
+            "\033]9;%ld\a", (long) time (NULL));
+
   /* on one of the systems I use, getcwd() does not return the same prefix
      as is listed in the passwd file */
   if ((p = getenv ("HOME")))
     Homedir = safe_strdup (p);
 
   /* Get some information about the user */
   /* on one of the systems I use, getcwd() does not return the same prefix
      as is listed in the passwd file */
   if ((p = getenv ("HOME")))
     Homedir = safe_strdup (p);
 
   /* Get some information about the user */
-  if ((pw = getpwuid (getuid ())))
-  {
+  if ((pw = getpwuid (getuid ()))) {
     char rnbuf[STRING];
 
     Username = safe_strdup (pw->pw_name);
     char rnbuf[STRING];
 
     Username = safe_strdup (pw->pw_name);
@@ -2130,18 +2054,15 @@ void mutt_init (int skip_sys_rc, LIST *commands)
     Realname = safe_strdup (mutt_gecos_name (rnbuf, sizeof (rnbuf), pw));
     Shell = safe_strdup (pw->pw_shell);
   }
     Realname = safe_strdup (mutt_gecos_name (rnbuf, sizeof (rnbuf), pw));
     Shell = safe_strdup (pw->pw_shell);
   }
-  else 
-  {
-    if (!Homedir)
-    {
+  else {
+    if (!Homedir) {
       mutt_endwin (NULL);
       fputs (_("unable to determine home directory"), stderr);
       exit (1);
     }
     if ((p = getenv ("USER")))
       Username = safe_strdup (p);
       mutt_endwin (NULL);
       fputs (_("unable to determine home directory"), stderr);
       exit (1);
     }
     if ((p = getenv ("USER")))
       Username = safe_strdup (p);
-    else
-    {
+    else {
       mutt_endwin (NULL);
       fputs (_("unable to determine username"), stderr);
       exit (1);
       mutt_endwin (NULL);
       fputs (_("unable to determine username"), stderr);
       exit (1);
@@ -2158,11 +2079,10 @@ void mutt_init (int skip_sys_rc, LIST *commands)
   /* And about the host... */
   uname (&utsname);
   /* some systems report the FQDN instead of just the hostname */
   /* And about the host... */
   uname (&utsname);
   /* some systems report the FQDN instead of just the hostname */
-  if ((p = strchr (utsname.nodename, '.')))
-  {
+  if ((p = strchr (utsname.nodename, '.'))) {
     Hostname = mutt_substrdup (utsname.nodename, p);
     p++;
     Hostname = mutt_substrdup (utsname.nodename, p);
     p++;
-    strfcpy (buffer, p, sizeof (buffer)); /* save the domain for below */
+    strfcpy (buffer, p, sizeof (buffer));       /* save the domain for below */
   }
   else
     Hostname = safe_strdup (utsname.nodename);
   }
   else
     Hostname = safe_strdup (utsname.nodename);
@@ -2173,27 +2093,27 @@ void mutt_init (int skip_sys_rc, LIST *commands)
     Fqdn = safe_strdup ("@");
   else
 #endif /* DOMAIN */
     Fqdn = safe_strdup ("@");
   else
 #endif /* DOMAIN */
-    if (*DOMAIN != '@')
-  {
+  if (*DOMAIN != '@') {
     Fqdn = safe_malloc (mutt_strlen (DOMAIN) + mutt_strlen (Hostname) + 2);
     Fqdn = safe_malloc (mutt_strlen (DOMAIN) + mutt_strlen (Hostname) + 2);
-    sprintf (Fqdn, "%s.%s", NONULL(Hostname), DOMAIN); /* __SPRINTF_CHECKED__ */
+    sprintf (Fqdn, "%s.%s", NONULL (Hostname), DOMAIN); /* __SPRINTF_CHECKED__ */
   }
   else
   }
   else
-    Fqdn = safe_strdup(NONULL(Hostname));
+    Fqdn = safe_strdup (NONULL (Hostname));
 
 #ifdef USE_NNTP
   {
     FILE *f;
     char *i;
 
 
 #ifdef USE_NNTP
   {
     FILE *f;
     char *i;
 
-    if ((f = safe_fopen (SYSCONFDIR "/nntpserver", "r")))
-    {
+    if ((f = safe_fopen (SYSCONFDIR "/nntpserver", "r"))) {
       buffer[0] = '\0';
       fgets (buffer, sizeof (buffer), f);
       buffer[0] = '\0';
       fgets (buffer, sizeof (buffer), f);
-      p = &buffer;
+      p = (char*) &buffer;
       SKIPWS (p);
       i = p;
       SKIPWS (p);
       i = p;
-      while (*i && (*i != ' ') && (*i != '\t') && (*i != '\r') && (*i != '\n')) i++;
+      while (*i && (*i != ' ') && (*i != '\t') && (*i != '\r')
+             && (*i != '\n'))
+        i++;
       *i = '\0';
       NewsServer = safe_strdup (p);
       fclose (f);
       *i = '\0';
       NewsServer = safe_strdup (p);
       fclose (f);
@@ -2207,29 +2127,28 @@ void mutt_init (int skip_sys_rc, LIST *commands)
     Spoolfile = safe_strdup (p);
   else if ((p = getenv ("MAILDIR")))
     Spoolfile = safe_strdup (p);
     Spoolfile = safe_strdup (p);
   else if ((p = getenv ("MAILDIR")))
     Spoolfile = safe_strdup (p);
-  else
-  {
+  else {
 #ifdef HOMESPOOL
     mutt_concat_path (buffer, NONULL (Homedir), MAILPATH, sizeof (buffer));
 #else
 #ifdef HOMESPOOL
     mutt_concat_path (buffer, NONULL (Homedir), MAILPATH, sizeof (buffer));
 #else
-    mutt_concat_path (buffer, MAILPATH, NONULL(Username), sizeof (buffer));
+    mutt_concat_path (buffer, MAILPATH, NONULL (Username), sizeof (buffer));
 #endif
     Spoolfile = safe_strdup (buffer);
   }
 
   if ((p = getenv ("MAILCAPS")))
     MailcapPath = safe_strdup (p);
 #endif
     Spoolfile = safe_strdup (buffer);
   }
 
   if ((p = getenv ("MAILCAPS")))
     MailcapPath = safe_strdup (p);
-  else
-  {
+  else {
     /* Default search path from RFC1524 */
     /* Default search path from RFC1524 */
-    MailcapPath = safe_strdup ("~/.mailcap:" PKGDATADIR "/mailcap:" SYSCONFDIR "/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap");
+    MailcapPath =
+      safe_strdup ("~/.mailcap:" PKGDATADIR "/mailcap:" SYSCONFDIR
+                   "/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap");
   }
 
   Tempdir = safe_strdup ((p = getenv ("TMPDIR")) ? p : "/tmp");
 
   p = getenv ("VISUAL");
   }
 
   Tempdir = safe_strdup ((p = getenv ("TMPDIR")) ? p : "/tmp");
 
   p = getenv ("VISUAL");
-  if (!p)
-  {
+  if (!p) {
     p = getenv ("EDITOR");
     if (!p)
       p = "vi";
     p = getenv ("EDITOR");
     if (!p)
       p = "vi";
@@ -2237,8 +2156,7 @@ void mutt_init (int skip_sys_rc, LIST *commands)
   Editor = safe_strdup (p);
   Visual = safe_strdup (p);
 
   Editor = safe_strdup (p);
   Visual = safe_strdup (p);
 
-  if ((p = getenv ("REPLYTO")) != NULL)
-  {
+  if ((p = getenv ("REPLYTO")) != NULL) {
     BUFFER buf, token;
 
     snprintf (buffer, sizeof (buffer), "Reply-To: %s", p);
     BUFFER buf, token;
 
     snprintf (buffer, sizeof (buffer), "Reply-To: %s", p);
@@ -2254,14 +2172,13 @@ void mutt_init (int skip_sys_rc, LIST *commands)
 
   if ((p = getenv ("EMAIL")) != NULL)
     From = rfc822_parse_adrlist (NULL, p);
 
   if ((p = getenv ("EMAIL")) != NULL)
     From = rfc822_parse_adrlist (NULL, p);
-  
+
   mutt_set_langinfo_charset ();
   mutt_set_charset (Charset);
   mutt_set_langinfo_charset ();
   mutt_set_charset (Charset);
-  
-  
+
+
   /* Set standard defaults */
   /* Set standard defaults */
-  for (i = 0; MuttVars[i].option; i++)
-  {
+  for (i = 0; MuttVars[i].option; i++) {
     mutt_set_default (&MuttVars[i]);
     mutt_restore_default (&MuttVars[i]);
   }
     mutt_set_default (&MuttVars[i]);
     mutt_restore_default (&MuttVars[i]);
   }
@@ -2279,87 +2196,84 @@ void mutt_init (int skip_sys_rc, LIST *commands)
 
 #ifdef HAVE_GETSID
   /* Unset suspend by default if we're the session leader */
 
 #ifdef HAVE_GETSID
   /* Unset suspend by default if we're the session leader */
-  if (getsid(0) == getpid())
+  if (getsid (0) == getpid ())
     unset_option (OPTSUSPEND);
 #endif
 
   mutt_init_history ();
 
     unset_option (OPTSUSPEND);
 #endif
 
   mutt_init_history ();
 
-  
-  
-  
+
+
+
   /*
    * 
   /*
    * 
-   *                      BIG FAT WARNING
+   *                       BIG FAT WARNING
    * 
    * When changing the code which looks for a configuration file,
    * please also change the corresponding code in muttbug.sh.in.
    * 
    * 
    */
    * 
    * When changing the code which looks for a configuration file,
    * please also change the corresponding code in muttbug.sh.in.
    * 
    * 
    */
-  
-  
-  
-  
-  if (!Muttrc)
-  {
-    snprintf (buffer, sizeof(buffer), "%s/.muttngrc-%s", NONULL(Homedir), MUTT_VERSION);
-    if (access(buffer, F_OK) == -1)
-      snprintf (buffer, sizeof(buffer), "%s/.muttngrc", NONULL(Homedir));
-    if (access(buffer, F_OK) == -1)
-      snprintf (buffer, sizeof (buffer), "%s/.muttng/muttngrc-%s", NONULL(Homedir), MUTT_VERSION);
-    if (access(buffer, F_OK) == -1)
-      snprintf (buffer, sizeof (buffer), "%s/.muttng/muttngrc", NONULL(Homedir));
-    
+
+
+
+
+  if (!Muttrc) {
+    snprintf (buffer, sizeof (buffer), "%s/.muttngrc-%s", NONULL (Homedir),
+              MUTT_VERSION);
+    if (access (buffer, F_OK) == -1)
+      snprintf (buffer, sizeof (buffer), "%s/.muttngrc", NONULL (Homedir));
+    if (access (buffer, F_OK) == -1)
+      snprintf (buffer, sizeof (buffer), "%s/.muttng/muttngrc-%s",
+                NONULL (Homedir), MUTT_VERSION);
+    if (access (buffer, F_OK) == -1)
+      snprintf (buffer, sizeof (buffer), "%s/.muttng/muttngrc",
+                NONULL (Homedir));
+
     default_rc = 1;
     Muttrc = safe_strdup (buffer);
   }
     default_rc = 1;
     Muttrc = safe_strdup (buffer);
   }
-  else
-  {
+  else {
     strfcpy (buffer, Muttrc, sizeof (buffer));
     FREE (&Muttrc);
     mutt_expand_path (buffer, sizeof (buffer));
     Muttrc = safe_strdup (buffer);
   }
   FREE (&AliasFile);
     strfcpy (buffer, Muttrc, sizeof (buffer));
     FREE (&Muttrc);
     mutt_expand_path (buffer, sizeof (buffer));
     Muttrc = safe_strdup (buffer);
   }
   FREE (&AliasFile);
-  AliasFile = safe_strdup (NONULL(Muttrc));
+  AliasFile = safe_strdup (NONULL (Muttrc));
 
   /* Process the global rc file if it exists and the user hasn't explicity
      requested not to via "-n".  */
 
   /* Process the global rc file if it exists and the user hasn't explicity
      requested not to via "-n".  */
-  if (!skip_sys_rc)
-  {
-    snprintf (buffer, sizeof(buffer), "%s/Muttngrc-%s", SYSCONFDIR, MUTT_VERSION);
+  if (!skip_sys_rc) {
+    snprintf (buffer, sizeof (buffer), "%s/Muttngrc-%s", SYSCONFDIR,
+              MUTT_VERSION);
     if (access (buffer, F_OK) == -1)
     if (access (buffer, F_OK) == -1)
-      snprintf (buffer, sizeof(buffer), "%s/Muttngrc", SYSCONFDIR);
+      snprintf (buffer, sizeof (buffer), "%s/Muttngrc", SYSCONFDIR);
     if (access (buffer, F_OK) == -1)
     if (access (buffer, F_OK) == -1)
-      snprintf (buffer, sizeof (buffer), "%s/Muttngrc-%s", PKGDATADIR, MUTT_VERSION);
+      snprintf (buffer, sizeof (buffer), "%s/Muttngrc-%s", PKGDATADIR,
+                MUTT_VERSION);
     if (access (buffer, F_OK) == -1)
       snprintf (buffer, sizeof (buffer), "%s/Muttngrc", PKGDATADIR);
     if (access (buffer, F_OK) == -1)
       snprintf (buffer, sizeof (buffer), "%s/Muttngrc", PKGDATADIR);
-    if (access (buffer, F_OK) != -1)
-    {
-      if (source_rc (buffer, &err) != 0)
-      {
-       fputs (err.data, stderr);
-       fputc ('\n', stderr);
-       need_pause = 1;
+    if (access (buffer, F_OK) != -1) {
+      if (source_rc (buffer, &err) != 0) {
+        fputs (err.data, stderr);
+        fputc ('\n', stderr);
+        need_pause = 1;
       }
     }
   }
 
   /* Read the user's initialization file.  */
       }
     }
   }
 
   /* Read the user's initialization file.  */
-  if (access (Muttrc, F_OK) != -1)
-  {
+  if (access (Muttrc, F_OK) != -1) {
     if (!option (OPTNOCURSES))
       endwin ();
     if (!option (OPTNOCURSES))
       endwin ();
-    if (source_rc (Muttrc, &err) != 0)
-    {
+    if (source_rc (Muttrc, &err) != 0) {
       fputs (err.data, stderr);
       fputc ('\n', stderr);
       need_pause = 1;
     }
   }
       fputs (err.data, stderr);
       fputc ('\n', stderr);
       need_pause = 1;
     }
   }
-  else if (!default_rc)
-  {
+  else if (!default_rc) {
     /* file specified by -F does not exist */
     snprintf (buffer, sizeof (buffer), "%s: %s", Muttrc, strerror (errno));
     mutt_endwin (buffer);
     /* file specified by -F does not exist */
     snprintf (buffer, sizeof (buffer), "%s: %s", Muttrc, strerror (errno));
     mutt_endwin (buffer);
@@ -2369,14 +2283,13 @@ void mutt_init (int skip_sys_rc, LIST *commands)
   if (mutt_execute_commands (commands) != 0)
     need_pause = 1;
 
   if (mutt_execute_commands (commands) != 0)
     need_pause = 1;
 
-  if (need_pause && !option (OPTNOCURSES))
-  {
+  if (need_pause && !option (OPTNOCURSES)) {
     if (mutt_any_key_to_continue (NULL) == -1)
     if (mutt_any_key_to_continue (NULL) == -1)
-      mutt_exit(1);
+      mutt_exit (1);
   }
 
 #if 0
   }
 
 #if 0
-  set_option (OPTWEED); /* turn weeding on by default */
+  set_option (OPTWEED);         /* turn weeding on by default */
 #endif
 }
 
 #endif
 }
 
@@ -2384,7 +2297,7 @@ int mutt_get_hook_type (const char *name)
 {
   struct command_t *c;
 
 {
   struct command_t *c;
 
-  for (c = Commands ; c->name ; c++)
+  for (c = Commands; c->name; c++)
     if (c->func == mutt_parse_hook && ascii_strcasecmp (c->name, name) == 0)
       return c->data;
   return 0;
     if (c->func == mutt_parse_hook && ascii_strcasecmp (c->name, name) == 0)
       return c->data;
   return 0;