mutt_extract_token (buf, s, 0);
+ dprint (2, (debugfile, "parse_alias: First token is '%s'.\n",
+ buf->data));
+
/* check to see if an alias with this name already exists */
for (; tmp; tmp = tmp->next)
{
}
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;
estr, tmp->name);
return -1;
}
+#ifdef DEBUG
+ if (debuglevel >= 2)
+ {
+ ADDRESS *a;
+ for (a = tmp->addr; a; a = a->next)
+ {
+ if (!a->group)
+ dprint (2, (debugfile, "parse_alias: %s\n",
+ a->mailbox));
+ else
+ dprint (2, (debugfile, "parse_alias: Group %s\n",
+ a->mailbox));
+ }
+ }
+#endif
return 0;
}
size_t buflen;
pid_t pid;
+ 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));
/* given a list of addresses, return a list of unique addresses */
ADDRESS *mutt_remove_duplicates (ADDRESS *addr)
{
- ADDRESS *top = NULL;
+ ADDRESS *top = addr;
+ ADDRESS **last = ⊤
ADDRESS *tmp;
-
- if ((top = addr) == NULL)
- return (NULL);
- addr = addr->next;
- top->next = NULL;
+ int dup;
+
while (addr)
{
- tmp = top;
- do {
- if (addr->mailbox && tmp->mailbox &&
+ for (tmp = top, dup = 0; tmp && tmp != addr; tmp = tmp->next)
+ {
+ if (tmp->mailbox && addr->mailbox &&
!ascii_strcasecmp (addr->mailbox, tmp->mailbox))
{
- /* duplicate address, just ignore it */
- tmp = addr;
- addr = addr->next;
- tmp->next = NULL;
- rfc822_free_address (&tmp);
- }
- else if (!tmp->next)
- {
- /* unique address. add it to the list */
- tmp->next = addr;
- addr = addr->next;
- tmp = tmp->next;
- tmp->next = NULL;
- tmp = NULL; /* so we exit the loop */
+ dup = 1;
+ break;
}
- else
- tmp = tmp->next;
- } while (tmp);
- }
+ }
+
+ if (dup)
+ {
+ dprint (2, (debugfile, "mutt_remove_duplicates: Removing %s\n",
+ addr->mailbox));
+
+ *last = addr->next;
+ addr->next = NULL;
+ rfc822_free_address(&addr);
+
+ addr = *last;
+ }
+ else
+ {
+ last = &addr->next;
+ addr = addr->next;
+ }
+ }
+
return (top);
}