Re: [PATCH] Mailbox Aliases
Hi,
* Bertrand Janin wrote:
> Yes, this would break. I'm not sure why someone would use '!!=foo' as a
> parameter to 'mailboxes' though ;)
You wrongly assume all config lines mutt gets are intentional the way
they are. :) Typos for example can occur. With:
mailboxes !=foo
a user could actually mean:
mailboxes ! =foo
which makes perfect sense. Hmm, actually this is ambigous with your
patch as it'd mean the same as alias=! for =foo (literally here, no
expansion of "=").
> I replaced:
> if (*buf != '=' && (p = strchr(buf, '=')) != NULL)
> By:
> if (strchr("~=+@!*><!-^", *buf) == NULL && (p = strchr(buf + 1, '=')) !=
> NULL)
Hmm. What if I have a = in a mailbox name? I thougt about using ':'
since it's the path separator on most target platforms already. Either
we would need a way to escape these, or find a better syntax (which I'd
prefer).
> + /* Extract mailbox alias if any. */
> + if (strchr("~=+@!*><!-^", *buf) == NULL && (p = strchr(buf, '=')) !=
> NULL)
> + {
> + alias = mutt_substrdup(buf, p);
> + strcpy(tbuf, p + 1);
> + strcpy(buf, tbuf);
> + }
Please don't use strcpy(). Please use the check_sec.sh script
mentioned (in hg tip) in doc/devel-notes.txt. Please use strfcpy() here.
> + if (alias != NULL)
> + {
> + mutt_str_replace(&(*tmp)->alias, alias);
> + free(alias);
> + }
Please use FREE(&alias) instead of free(alias).
Rocco