<<< Date Index >>>     <<< Thread Index >>>

Re: Aliases for users w/ multiple addresses?



On Fri, Apr 23, 2004 at 03:01:14PM +0200, Andre Bonhote wrote:
>  
>  abook[1] rocks. It's a tiny application which allows you to set up to
>  4 e-mail addresses per name. Console, too.
> 
>  Cheers & HTH
> 
>  A.
> 
>  [1] http://abook.sf.net

OK, I tried it.  It has a bug reading mutt aliases, looks like
it may have been introduced by a patch earlier this year.  If
you convert a mutt aliases file (via --convert --informat mutt)
you end up with alias names that are all one character too short.

Here's a patch that works for me.  Hopefully it will help someone
(or be debunked... either one is fine :-) ).

mm


----start (mutt-short-alias.patch)----
This patch fixes a bug in reading mutt alias definitions.  Without the
patch, the alias name is truncated one character too short.  

Note that this patch is enabled only in a new code chunk in a MV_COMM
conditional, 'cuz that's the way I like to insert changes here (so that
I can uncompile them easily).  You will want to enable MV_COMM somewhere,
or just rip out the old code.

-mm-            Mark Mallett, mem@xxxxxxxxxx, 20040424



*** filter.c.orig       Fri Jan 23 02:14:32 2004
--- filter.c    Sat Apr 24 00:47:04 2004
***************
*** 640,645 ****
--- 640,646 ----
        while( ! ISSPACE(*ptr) )
                ptr++;
  
+ #ifndef       MV_COMM         /* mem 20040424 one too few bytes copied here */
        if( (*alias = (char *)malloc(ptr - tmp)) == NULL) {
                free(line);
                return 1;
***************
*** 647,652 ****
--- 648,662 ----
  
        strncpy(*alias, tmp, ptr - tmp - 1);
        *(*alias + (ptr - tmp - 1)) = 0;
+ #else
+       if( (*alias = (char *)malloc( (ptr - tmp) +1)) == NULL) {
+               free(line);
+               return 1;
+       }
+ 
+       strncpy(*alias, tmp, ptr - tmp);
+       *(*alias + (ptr - tmp)) = 0;
+ #endif        /* MV_COMM */
  
        while(ISSPACE(*ptr))
                ptr++;

----end----