]> diplodocus.org Git - nmh/commitdiff
make the %(size) function useful in mhshow marker line formats
authorPaul Fox <pgf@foxharp.boston.ma.us>
Tue, 6 May 2014 15:54:52 +0000 (11:54 -0400)
committerPaul Fox <pgf@foxharp.boston.ma.us>
Wed, 7 May 2014 15:07:14 +0000 (11:07 -0400)
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
uip/mhshowsbr.c

index ed511463bda43d05fdcf9df297f433a9d1fa48da..ac228f06bec8e076bac1014f0ce3545457813f11 100644 (file)
@@ -622,7 +622,8 @@ disposition string  Content disposition (attachment or inline)
 ctype-<PARAM>  string  Value of <PARAM> from Content\-Type header
 cdispo-<PARAM> string  Value of <PARAM> from
                Content\-Disposition header
 ctype-<PARAM>  string  Value of <PARAM> from Content\-Type header
 cdispo-<PARAM> string  Value of <PARAM> 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
 .fi
 In this context, the %(unseen) function indicates whether
 .B mhshow
index 8bd5f99add6d9c10834696226f9bd8c0451e2844..679d8be505edb2bb30e8744d455fe80daa4377a7 100644 (file)
@@ -1289,6 +1289,7 @@ output_marker(CT ct, struct format *fmt, int hidden)
 {
     char outbuf[BUFSIZ];
     struct param_comp_list *pcentry;
 {
     char outbuf[BUFSIZ];
     struct param_comp_list *pcentry;
+    int partsize;
     int dat[5];
 
     /*
     int dat[5];
 
     /*
@@ -1322,11 +1323,18 @@ output_marker(CT ct, struct format *fmt, int hidden)
                                          pcentry->param, '?', 0);
     }
 
                                          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
     /* 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[4] = hidden;
+    dat[0] = dat[1] = dat[3] = 0;
 
     fmt_scan(fmt, outbuf, sizeof(outbuf), sizeof(outbuf), dat, NULL);
 
 
     fmt_scan(fmt, outbuf, sizeof(outbuf), sizeof(outbuf), dat, NULL);