From 039523b0bede337327c5ff7529e3d463aaee7d8a Mon Sep 17 00:00:00 2001 From: Paul Fox Date: Tue, 6 May 2014 11:54:52 -0400 Subject: [PATCH] make the %(size) function useful in mhshow marker line formats normally %(size) returns the size of the message. in mhshow marker lines, it returns the size of the (decoded, if necessary) part. --- man/mhshow.man | 3 ++- uip/mhshowsbr.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/man/mhshow.man b/man/mhshow.man index ed511463..ac228f06 100644 --- a/man/mhshow.man +++ b/man/mhshow.man @@ -622,7 +622,8 @@ disposition string Content disposition (attachment or inline) ctype- string Value of from Content\-Type header cdispo- string Value of from Content\-Disposition header -%(unseen) boolean Returns true for suppressed parts. +%(size) integer The size of the decoded part, in bytes +%(unseen) boolean Returns true for suppressed parts .fi In this context, the %(unseen) function indicates whether .B mhshow diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 8bd5f99a..679d8be5 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -1289,6 +1289,7 @@ output_marker(CT ct, struct format *fmt, int hidden) { char outbuf[BUFSIZ]; struct param_comp_list *pcentry; + int partsize; int dat[5]; /* @@ -1322,11 +1323,18 @@ output_marker(CT ct, struct format *fmt, int hidden) pcentry->param, '?', 0); } + if (ct->c_cesizefnx) + partsize = (*ct->c_cesizefnx) (ct); + else + partsize = ct->c_end - ct->c_begin; + /* make the part's hidden aspect available by overloading the - * %(unseen) function. see comments in h/fmt_scan.h. + * %(unseen) function. make the part's size available via %(size). + * see comments in h/fmt_scan.h. */ - dat[0] = dat[1] = dat[2] = dat[3] = 0; + dat[2] = partsize; dat[4] = hidden; + dat[0] = dat[1] = dat[3] = 0; fmt_scan(fmt, outbuf, sizeof(outbuf), sizeof(outbuf), dat, NULL); -- 2.56.0