Rocco Rutte:
authorpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Mon, 18 Apr 2005 11:43:59 +0000 (11:43 +0000)
committerpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Mon, 18 Apr 2005 11:43:59 +0000 (11:43 +0000)
- warn about synonym variables which are completely scheduled for removal

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@271 e385b8ad-14ed-0310-8656-cc95a2468c6d

init.c

diff --git a/init.c b/init.c
index 37f8781..6e5bf03 100644 (file)
--- a/init.c
+++ b/init.c
@@ -41,6 +41,8 @@
 #include <errno.h>
 #include <sys/wait.h>
 
+list2_t* Synonyms;
+
 void toggle_quadoption (int opt)
 {
   int n = opt / 4;
@@ -91,9 +93,12 @@ int mutt_option_index (char *s)
   int i;
 
   for (i = 0; MuttVars[i].option; i++)
-    if (safe_strcmp (s, MuttVars[i].option) == 0)
+    if (safe_strcmp (s, MuttVars[i].option) == 0) {
+      if (MuttVars[i].type == DT_SYN)
+        list_push_back (&Synonyms, &MuttVars[i]);
       return (MuttVars[i].type ==
               DT_SYN ? mutt_option_index ((char *) MuttVars[i].data) : i);
+    }
   return (-1);
 }
 
@@ -2282,6 +2287,19 @@ void mutt_init (int skip_sys_rc, LIST * commands)
   if (mutt_execute_commands (commands) != 0)
     need_pause = 1;
 
+  /* warn about synonym variables */
+  if (!list_empty(Synonyms)) {
+    int i = 0;
+    fprintf (stderr, _("Warning: the following synonym variables were found:\n"));
+    for (i = 0; i < Synonyms->length; i++)
+      fprintf (stderr, "$%s (for $%s)\n",
+               ((struct option_t*) Synonyms->data[i])->option,
+               (char*) ((struct option_t*) Synonyms->data[i])->data);
+    fprintf (stderr, _("Warning: Synonym variables are scheduled for removal.\n"));
+    list_del (&Synonyms, NULL);
+    need_pause = 1;
+  }
+
   if (need_pause && !option (OPTNOCURSES)) {
     if (mutt_any_key_to_continue (NULL) == -1)
       mutt_exit (1);