X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/a1f79aa7a083e74292c0f0654010179082da7a94..42db3a2c36e26e0106b1e480407e32d3c8c09bef:/uip/mhshowsbr.c diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 59f6f437..ef010721 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -6,6 +6,9 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" +#include "sbr/concat.h" +#include "sbr/trimcpy.h" #include "sbr/check_charset.h" #include "sbr/getcpy.h" #include "sbr/context_find.h" @@ -100,7 +103,6 @@ void show_all_messages(CT *cts, int concat, int textonly, int inlineonly) { CT ct, *ctp; - struct format *hfmt, *mfmt; /* * If form is not specified, then get default form @@ -109,12 +111,6 @@ show_all_messages(CT *cts, int concat, int textonly, int inlineonly) if (!formsw) formsw = mh_xstrdup(etcpath("mhl.headers")); - /* - * Compile the content marker and header format lines - */ - mfmt = compile_marker(markerform); - hfmt = compile_header(headerform); - /* * If form is "mhl.null", suppress display of header. */ @@ -126,16 +122,30 @@ show_all_messages(CT *cts, int concat, int textonly, int inlineonly) /* if top-level type is ok, then display message */ if (type_ok (ct, 1)) { - if (headersw) output_header(ct, hfmt); + /* + * Compile the content marker format line + */ + struct format *mfmt = compile_marker(markerform);; + + if (headersw) { + /* + * Compile the header format line + */ + struct format *hfmt = compile_header(headerform); + output_header(ct, hfmt); + fmt_free(hfmt, 0); + } show_single_message (ct, formsw, concat, textonly, inlineonly, mfmt); + fmt_free(mfmt, 0); } } + /* Reset the format component hashtable, which free's any components which + it references. */ + fmt_free(NULL, 1); free_markercomps(); - fmt_free(hfmt, 1); - fmt_free(mfmt, 1); } @@ -467,7 +477,6 @@ show_content_aux2 (CT ct, int alternate, char *cracked, char *buffer, } vec = argsplit(buffer, &file, &vecp); - vec[vecp++] = NULL; fflush (stdout); @@ -1313,7 +1322,7 @@ compile_header(char *form) fmtstring = new_fs(form, NULL, DEFAULT_HEADER); - (void) fmt_compile(fmtstring, &fmt, 1); + (void) fmt_compile(fmtstring, &fmt, 0); free_fs(); while ((comp = fmt_nextcomp(comp, &bucket)) != NULL) { @@ -1336,7 +1345,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(); /*