On Mon, Dec 19, 2005 at 03:40:34PM -0800, Seth Arnold wrote: > On Mon, Dec 19, 2005 at 03:08:26PM -0800, Brendan Cully wrote: > > I've read it but not yet tried it. Looks good in theory :) Why not go > > ahead and update the docs? > > Great. I'll send a new patch with updated docs and the *cough* strdup() > memleak fixed for inclusion soon. (I was just so happy to get the > functionality that I forgot to cleanup my memory allocation. *sigh*) Brenden, thank you for the feedback. After a longer wait than I expected, I finally had the freetime I needed to finish this patch. I got a little concerned about patching all the documentation files in fundementally the same way, but I quickly got tired of reading the Makefile to figure out which docs are the masters and which docs are the slaves. So I patched them all. :) Please select the hunks you want to apply.. The version of this patch which leaked memory has been in constant use since Dec 19 with the following rules: folder-hook .*suse.* color body white blue subdomain folder-hook .*suse.* color body white blue apparmor folder-hook .*suse.* color index green default ~Bapparmor folder-hook .*suse.* color index green default ~Bsubdomain folder-hook !.*suse.* uncolor body subdomain folder-hook !.*suse.* uncolor body apparmor folder-hook !.*suse.* uncolor index ~Bsubdomain folder-hook !.*suse.* uncolor index ~Bapparmor folder-hook .*suse-fate.* color body white blue Title:.* folder-hook !.*suse-fate.* uncolor body Title:.* folder-hook .*security-admin.* color index green default pdx folder-hook !.*security-admin.* uncolor index pdx folder-hook .*security-admin.* color index green default apparmor folder-hook !.*security-admin.* uncolor index apparmor folder-hook .*security-admin.* color body cyan default List:.*xxxxxxxxxxx folder-hook !.*security-admin.* uncolor body List:.*xxxxxxxxxxx folder-hook .*security-admin.* color body cyan default List:.*apparmor.* folder-hook !.*security-admin.* uncolor index List:.*apparmor.* The version of this patch with the memory leak fixed has been in use for an hour now, with the same rules. Please consider this patch for inclusion into mutt. Thanks you
--- mutt-1.5.9/doc/manual-3.html.uncolor-body-header 2006-02-07 17:57:24.000000000 -0800 +++ mutt-1.5.9/doc/manual-3.html 2006-02-07 17:58:54.000000000 -0800 @@ -339,6 +339,8 @@ <P>Usage: <CODE>color</CODE> <EM>object</EM> <EM>foreground</EM> <EM>background</EM> [ <EM>regexp</EM> ]<BR> Usage: <CODE>color</CODE> index <EM>foreground</EM> <EM>background</EM> <EM>pattern</EM><BR> Usage: <CODE>uncolor</CODE> index <EM>pattern</EM> [ <EM>pattern</EM> ... ]<BR></P> +Usage: <CODE>uncolor</CODE> body <EM>pattern</EM> [ <EM>pattern</EM> ... ]<BR></P> +Usage: <CODE>uncolor</CODE> header <EM>pattern</EM> [ <EM>pattern</EM> ... ]<BR></P> <P>If your terminal supports color, you can spice up Mutt by creating your own color scheme. To define the color of an object (type of information), you must specify both a foreground color <B>and</B> a background color (it is not @@ -401,7 +403,7 @@ <P><B>Note:</B> The <EM>S-Lang</EM> library requires you to use the <EM>lightgray</EM> and <EM>brown</EM> keywords instead of <EM>white</EM> and <EM>yellow</EM> when setting this variable.</P> -<P><B>Note:</B> The uncolor command can be applied to the index object only. It +<P><B>Note:</B> The uncolor command can be applied to the index, body, and header objects only. It removes entries from the list. You <B>must</B> specify the same pattern specified in the color command for it to be removed. The pattern ``*'' is a special token which means to clear the color index list of all entries.</P> --- mutt-1.5.9/doc/manual-6.html.uncolor-body-header 2006-02-07 17:57:24.000000000 -0800 +++ mutt-1.5.9/doc/manual-6.html 2006-02-07 17:59:18.000000000 -0800 @@ -96,6 +96,10 @@ <LI><CODE> <A HREF="manual-3.html#color">uncolor</A></CODE> <EM>index</EM> <EM>pattern</EM> [ <EM>pattern</EM> ... ]</LI> <LI><CODE> +<A HREF="manual-3.html#color">uncolor</A></CODE> <EM>body</EM> <EM>pattern</EM> [ <EM>pattern</EM> ... ]</LI> +<LI><CODE> +<A HREF="manual-3.html#color">uncolor</A></CODE> <EM>header</EM> <EM>pattern</EM> [ <EM>pattern</EM> ... ]</LI> +<LI><CODE> <A HREF="manual-3.html#exec">exec</A></CODE> <EM>function</EM> [ <EM>function</EM> ... ]</LI> <LI><CODE> <A HREF="manual-3.html#fcc-hook">fcc-hook</A></CODE> <EM>pattern</EM> <EM>mailbox</EM></LI> --- mutt-1.5.9/doc/manual.sgml.uncolor-body-header 2006-02-07 17:57:24.000000000 -0800 +++ mutt-1.5.9/doc/manual.sgml 2006-02-07 17:59:53.000000000 -0800 @@ -1053,6 +1053,8 @@ Usage: <tt/color/ <em/object/ <em/foreground/ <em/background/ [ <em/regexp/ ]<newline> Usage: <tt/color/ index <em/foreground/ <em/background/ <em/pattern/<newline> Usage: <tt/uncolor/ index <em/pattern/ [ <em/pattern/ ... ]<newline> +Usage: <tt/uncolor/ body <em/pattern/ [ <em/pattern/ ... ]<newline> +Usage: <tt/uncolor/ header <em/pattern/ [ <em/pattern/ ... ]<newline> If your terminal supports color, you can spice up Mutt by creating your own color scheme. To define the color of an object (type of information), you @@ -1117,7 +1119,7 @@ and <em/brown/ keywords instead of <em/white/ and <em/yellow/ when setting this variable. -<bf/Note:/ The uncolor command can be applied to the index object only. It +<bf/Note:/ The uncolor command can be applied to the index, body, and header objects only. It removes entries from the list. You <bf/must/ specify the same pattern specified in the color command for it to be removed. The pattern ``*'' is a special token which means to clear the color index list of all entries. @@ -3304,6 +3306,10 @@ <item> <tt><ref id="color" name="uncolor"></tt> <em/index/ <em/pattern/ [ <em/pattern/ ... ] <item> +<tt><ref id="color" name="uncolor"></tt> <em/body/ <em/pattern/ [ <em/pattern/ ... ] +<item> +<tt><ref id="color" name="uncolor"></tt> <em/header/ <em/pattern/ [ <em/pattern/ ... ] +<item> <tt><ref id="exec" name="exec"></tt> <em/function/ [ <em/function/ ... ] <item> <tt><ref id="fcc-hook" name="fcc-hook"></tt> <em/pattern/ <em/mailbox/ --- mutt-1.5.9/doc/manual.sgml.head.uncolor-body-header 2006-02-07 17:57:24.000000000 -0800 +++ mutt-1.5.9/doc/manual.sgml.head 2006-02-07 18:00:23.000000000 -0800 @@ -1053,6 +1053,8 @@ Usage: <tt/color/ <em/object/ <em/foreground/ <em/background/ [ <em/regexp/ ]<newline> Usage: <tt/color/ index <em/foreground/ <em/background/ <em/pattern/<newline> Usage: <tt/uncolor/ index <em/pattern/ [ <em/pattern/ ... ]<newline> +Usage: <tt/uncolor/ body <em/pattern/ [ <em/pattern/ ... ]<newline> +Usage: <tt/uncolor/ header <em/pattern/ [ <em/pattern/ ... ]<newline> If your terminal supports color, you can spice up Mutt by creating your own color scheme. To define the color of an object (type of information), you @@ -1117,7 +1119,7 @@ and <em/brown/ keywords instead of <em/white/ and <em/yellow/ when setting this variable. -<bf/Note:/ The uncolor command can be applied to the index object only. It +<bf/Note:/ The uncolor command can be applied to the index, body, and header objects only. It removes entries from the list. You <bf/must/ specify the same pattern specified in the color command for it to be removed. The pattern ``*'' is a special token which means to clear the color index list of all entries. @@ -3304,6 +3306,10 @@ <item> <tt><ref id="color" name="uncolor"></tt> <em/index/ <em/pattern/ [ <em/pattern/ ... ] <item> +<tt><ref id="color" name="uncolor"></tt> <em/body/ <em/pattern/ [ <em/pattern/ ... ] +<item> +<tt><ref id="color" name="uncolor"></tt> <em/header/ <em/pattern/ [ <em/pattern/ ... ] +<item> <tt><ref id="exec" name="exec"></tt> <em/function/ [ <em/function/ ... ] <item> <tt><ref id="fcc-hook" name="fcc-hook"></tt> <em/pattern/ <em/mailbox/ --- mutt-1.5.9/doc/manual.txt.uncolor-body-header 2006-02-07 17:57:24.000000000 -0800 +++ mutt-1.5.9/doc/manual.txt 2006-02-07 18:01:50.000000000 -0800 @@ -1372,6 +1372,8 @@ Usage: color _o_b_j_e_c_t _f_o_r_e_g_r_o_u_n_d _b_a_c_k_g_r_o_u_n_d [ _r_e_g_e_x_p ] Usage: color index _f_o_r_e_g_r_o_u_n_d _b_a_c_k_g_r_o_u_n_d _p_a_t_t_e_r_n Usage: uncolor index _p_a_t_t_e_r_n [ _p_a_t_t_e_r_n ... ] + Usage: uncolor body _p_a_t_t_e_r_n [ _p_a_t_t_e_r_n ... ] + Usage: uncolor header _p_a_t_t_e_r_n [ _p_a_t_t_e_r_n ... ] If your terminal supports color, you can spice up Mutt by creating your own color scheme. To define the color of an object (type of @@ -1459,7 +1461,7 @@ NNoottee:: The _S_-_L_a_n_g library requires you to use the _l_i_g_h_t_g_r_a_y and _b_r_o_w_n keywords instead of _w_h_i_t_e and _y_e_l_l_o_w when setting this variable. - NNoottee:: The uncolor command can be applied to the index object only. It + NNoottee:: The uncolor command can be applied to the index, body, and header objects only. It removes entries from the list. You mmuusstt specify the same pattern specified in the color command for it to be removed. The pattern ``*'' is a special token which means to clear the color index list of @@ -3407,6 +3409,10 @@ +o ``uncolor'' _i_n_d_e_x _p_a_t_t_e_r_n [ _p_a_t_t_e_r_n ... ] + +o ``uncolor'' _b_o_d_y _p_a_t_t_e_r_n [ _p_a_t_t_e_r_n ... ] + + +o ``uncolor'' _h_e_a_d_e_r _p_a_t_t_e_r_n [ _p_a_t_t_e_r_n ... ] + +o ``exec'' _f_u_n_c_t_i_o_n [ _f_u_n_c_t_i_o_n ... ] +o ``fcc-hook'' _p_a_t_t_e_r_n _m_a_i_l_b_o_x --- mutt-1.5.9/doc/muttrc.man.uncolor-body-header 2006-02-07 17:57:24.000000000 -0800 +++ mutt-1.5.9/doc/muttrc.man 2006-02-07 18:02:00.000000000 -0800 @@ -187,6 +187,8 @@ \fBcolor\fP \fIobject\fP \fIforeground\fP \fIbackground\fP [ \fI regexp\fP ] \fBcolor\fP index \fIforeground\fP \fIbackground\fP [ \fI pattern\fP ] \fBuncolor\fP index \fIpattern\fP [ \fIpattern\fP ... ] +\fBuncolor\fP body \fIpattern\fP [ \fIpattern\fP ... ] +\fBuncolor\fP header \fIpattern\fP [ \fIpattern\fP ... ] .fi .IP If your terminal supports color, these commands can be used to --- mutt-1.5.9/doc/muttrc.man.head.uncolor-body-header 2006-02-07 17:57:24.000000000 -0800 +++ mutt-1.5.9/doc/muttrc.man.head 2006-02-07 18:02:14.000000000 -0800 @@ -187,6 +187,8 @@ \fBcolor\fP \fIobject\fP \fIforeground\fP \fIbackground\fP [ \fI regexp\fP ] \fBcolor\fP index \fIforeground\fP \fIbackground\fP [ \fI pattern\fP ] \fBuncolor\fP index \fIpattern\fP [ \fIpattern\fP ... ] +\fBuncolor\fP body \fIpattern\fP [ \fIpattern\fP ... ] +\fBuncolor\fP header \fIpattern\fP [ \fIpattern\fP ... ] .fi .IP If your terminal supports color, these commands can be used to --- mutt-1.5.9/color.c.uncolor-body-header 2005-02-03 10:47:52.000000000 -0800 +++ mutt-1.5.9/color.c 2006-02-07 17:53:13.000000000 -0800 @@ -369,7 +369,8 @@ short parse_uncolor) { int object = 0, do_cache = 0; - COLOR_LINE *tmp, *last = NULL; + char *list; + COLOR_LINE *which, *tmp, *last = NULL; mutt_extract_token (buf, s, 0); @@ -379,11 +380,22 @@ return (-1); } - if (mutt_strncmp (buf->data, "index", 5) != 0) + list = strdup(buf->data); + if (!list) { snprintf (err->data, err->dsize, - _("%s: command valid only for index object"), - parse_uncolor ? "uncolor" : "unmono"); + _("%s: could not allocate storage for %.16s"), + parse_uncolor ? "uncolor" : "unmono", buf->data); + return (-1); + } + if (!((mutt_strncmp (list, "index", 5) == 0) || + (mutt_strncmp (list, "body", 4) ==0) || + (mutt_strncmp (list, "header", 7) ==0))) + { + snprintf (err->data, err->dsize, + _("%s: command valid only for index, body, header objects, not %.16s"), + parse_uncolor ? "uncolor" : "unmono", buf->data); + free(list); return (-1); } @@ -391,6 +403,7 @@ { snprintf (err->data, err->dsize, _("%s: too few arguments"), parse_uncolor ? "uncolor" : "unmono"); + free(list); return (-1); } @@ -413,16 +426,24 @@ mutt_extract_token (buf, s, 0); while (MoreArgs (s)); + free(list); return 0; } + if (mutt_strncmp(list, "index", 5) == 0) + which = ColorIndexList; + else if (mutt_strncmp(list, "body", 4) == 0) + which = ColorBodyList; + else if (mutt_strncmp(list, "header", 7) == 0) + which = ColorHdrList; + do { mutt_extract_token (buf, s, 0); if (!mutt_strcmp ("*", buf->data)) { - for (tmp = ColorIndexList; tmp; ) + for (tmp = which; tmp; ) { if (!do_cache) do_cache = 1; @@ -430,22 +451,33 @@ tmp = tmp->next; mutt_free_color_line(&last, parse_uncolor); } - ColorIndexList = NULL; + if (mutt_strncmp(list, "index", 5) == 0) + ColorIndexList = NULL; + else if (mutt_strncmp(list, "body", 4) == 0) + ColorBodyList = NULL; + else if (mutt_strncmp(list, "header", 7) == 0) + ColorHdrList = NULL; } else { - for (last = NULL, tmp = ColorIndexList; tmp; last = tmp, tmp = tmp->next) + for (last = NULL, tmp = which; tmp; last = tmp, tmp = tmp->next) { if (!mutt_strcmp (buf->data, tmp->pattern)) { if (!do_cache) do_cache = 1; - dprint(1,(debugfile,"Freeing pattern \"%s\" from ColorIndexList\n", - tmp->pattern)); + dprint(1,(debugfile,"Freeing pattern \"%s\" from \"%s\"\n", + tmp->pattern, list ? list : "NULL")); if (last) last->next = tmp->next; - else - ColorIndexList = tmp->next; + else { + if (mutt_strncmp(list, "index", 5) == 0) + ColorIndexList = tmp->next; + else if (mutt_strncmp(list, "body", 4) == 0) + ColorBodyList = tmp->next; + else if (mutt_strncmp(list, "header", 7) == 0) + ColorHdrList = tmp->next; + } mutt_free_color_line(&tmp, parse_uncolor); break; } @@ -463,6 +495,7 @@ for (i = 0; Context && i < Context->msgcount; i++) Context->hdrs[i]->pair = 0; } + free(list); return (0); }
Attachment:
pgp4tqLo7caea.pgp
Description: PGP signature