X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/d79618303ff42aa5e0bc2dba51fdd7b385bc97d4..fc8e02dc2074ce73276afc6f48919b9ecb32a409:/uip/mhshowsbr.c diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 92c20974..cd53d145 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -6,6 +6,10 @@ */ #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" #include "sbr/pidstatus.h" @@ -13,7 +17,6 @@ #include "sbr/error.h" #include #include "h/signals.h" -#include "h/md5.h" #include "h/mts.h" #include "h/tws.h" #include "h/mime.h" @@ -30,8 +33,6 @@ extern int debugsw; -int nolist = 0; - char *progsw = NULL; /* flags for moreproc/header display */ @@ -58,7 +59,6 @@ static int show_multi (CT, int, int, int, int, struct format *); static int show_multi_internal (CT, int, int, int, int, struct format *); static int show_multi_aux (CT, int, char *, struct format *); static int show_message_rfc822 (CT, int, struct format *); -static int show_partial (CT, int); static int show_external (CT, int, int, int, int, struct format *); static int parse_display_string (CT, char *, int *, int *, char *, char *, size_t, int multipart); @@ -99,7 +99,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 @@ -108,12 +107,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. */ @@ -125,16 +118,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); } @@ -261,9 +268,6 @@ show_switch (CT ct, int alternate, int concatsw, int textonly, int inlineonly, case CT_MESSAGE: switch (ct->c_subtype) { - case MESSAGE_PARTIAL: - return show_partial (ct, alternate); - case MESSAGE_EXTERNAL: return show_external (ct, alternate, concatsw, textonly, inlineonly, fmt); @@ -277,7 +281,7 @@ show_switch (CT ct, int alternate, int concatsw, int textonly, int inlineonly, */ default: return show_content (ct, alternate, textonly, - inlineonly, fmt); + inlineonly, fmt); } case CT_TEXT: @@ -380,7 +384,7 @@ show_content_aux (CT ct, int alternate, char *cp, char *cracked, struct format * } if (parse_display_string (ct, cp, &xstdin, &xlist, file, buffer, - sizeof(buffer) - 1, 0)) { + sizeof(buffer) - 1, 0)) { inform("Buffer overflow constructing show command, continuing..."); return NOTOK; } @@ -466,7 +470,6 @@ show_content_aux2 (CT ct, int alternate, char *cracked, char *buffer, } vec = argsplit(buffer, &file, &vecp); - vec[vecp++] = NULL; fflush (stdout); @@ -758,21 +761,6 @@ show_message_rfc822 (CT ct, int alternate, struct format *fmt) } -/* - * Show content of type "message/partial". - */ - -static int -show_partial (CT ct, int alternate) -{ - NMH_UNUSED (alternate); - - content_error (NULL, ct, - "in order to display this message, you must reassemble it"); - return NOTOK; -} - - /* * Show content of type "message/external". * @@ -903,7 +891,7 @@ parse_display_string (CT ct, char *cp, int *xstdin, int *xlist, case 'l': /* display listing prior to displaying content */ - *xlist = !nolist; + *xlist = 1; break; case 's': @@ -1312,7 +1300,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) { @@ -1335,7 +1323,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(); /*