From 037aeaf61ace944c3e763346f2f2b877624e6e67 Mon Sep 17 00:00:00 2001 From: David Levine Date: Wed, 7 Feb 2018 20:43:59 -0500 Subject: [PATCH] Fixed mhshow part markers when displaying multiple messages. Added test/mhshow/test-markers, it reveals the problem. --- Makefile.am | 1 + test/mhshow/test-markers | 67 ++++++++++++++++++++++++++++++++++++++++ uip/mhshowsbr.c | 11 ++++--- 3 files changed, 75 insertions(+), 4 deletions(-) create mode 100755 test/mhshow/test-markers diff --git a/Makefile.am b/Makefile.am index d8f92345..e7e4066a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -107,6 +107,7 @@ TESTS = \ test/mhshow/test-charset \ test/mhshow/test-cte-binary \ test/mhshow/test-exec \ + test/mhshow/test-markers \ test/mhshow/test-msg-buffer-boundaries \ test/mhshow/test-qp \ test/mhshow/test-subpart \ diff --git a/test/mhshow/test-markers b/test/mhshow/test-markers new file mode 100755 index 00000000..c0e8489a --- /dev/null +++ b/test/mhshow/test-markers @@ -0,0 +1,67 @@ +#!/bin/sh +###################################################### +# +# Test mhshow part markers +# +###################################################### + +if test -z "${MH_OBJ_DIR}"; then + srcdir=`dirname "$0"`/../.. + MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR +fi + +. "$MH_OBJ_DIR/test/common.sh" + +setup_test +expected=$MH_TEST_DIR/$$.expected +actual=$MH_TEST_DIR/$$.actual + +start_test + +# check markers when showing multiple messages +start_test "makers when showing multiple messages" +cat >"$expected" <"`mhpath new`" <"`mhpath new`" < "$actual" +check "$expected" "$actual" + + +finish_test +exit $failed diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index e4c93a87..7cfe0492 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -113,9 +113,8 @@ show_all_messages(CT *cts, int concat, int textonly, int inlineonly) formsw = mh_xstrdup(etcpath("mhl.headers")); /* - * Compile the content marker and header format lines + * Compile the header format line */ - mfmt = compile_marker(markerform); hfmt = compile_header(headerform); /* @@ -131,14 +130,18 @@ show_all_messages(CT *cts, int concat, int textonly, int inlineonly) if (type_ok (ct, 1)) { if (headersw) output_header(ct, hfmt); + /* + * Compile the content marker format line + */ + mfmt = compile_marker(markerform); show_single_message (ct, formsw, concat, textonly, inlineonly, mfmt); + fmt_free(mfmt, 0); } } free_markercomps(); fmt_free(hfmt, 1); - fmt_free(mfmt, 1); } @@ -1338,7 +1341,7 @@ compile_marker(char *form) fmtstring = new_fs(form, NULL, DEFAULT_MARKER); - (void) fmt_compile(fmtstring, &fmt, 1); + (void) fmt_compile(fmtstring, &fmt, 0); free_fs(); /* -- 2.56.0