[comp.mail.mh] Extra blank lines in MHL

neil@CompSci.Bristol.AC.UK (Neil Davies) (05/25/89)

Does anyone out there know how to suppress the blank line that follows any
field used with the formatfield option, eg

    Date:formatfield="%<(nodate{text})%{text}%|%(pretty{text})%>"
    To:

in mhl.format, will *always* generate something of the form

    Date: Thu, 18 May 89 10:06:04 BST

    To: fred

And try as I may I have been unable to suppress that blank line,
anyonme got any helpful hints?

Thanks

Neil

gregg@cbnewsc.ATT.COM (gregg.g.wonderly) (05/30/89)

From article <840@csisles.Bristol.AC.UK>, by neil@CompSci.Bristol.AC.UK (Neil Davies):
> 
> Does anyone out there know how to suppress the blank line that follows any
> field used with the formatfield option, eg
> 
>     Date:formatfield="%<(nodate{text})%{text}%|%(pretty{text})%>"
>     To:

The problem is more with dates than anything else.  Think of what ctime(3)
returns and you will understand why.  The solution is a code modification to
eliminate the newline from the buffer.

I would prefer that mhl behave more like scan(1) formatting where newlines are
output explicitly rather than implicitly.  Perhaps mhl style formatting should
be dropped in favor of the more flexible scan(1) formatting.  While we're at
it, perhaps the 1 line scan line could be extended to whatever is reasonable.
The fmtscan() function should accept a file indicator (FILE * or fd) so that
all of that silly buffer building and maintaining could be replaced with
simple I/O as each output character is derived/generated.  Comments?

-- 
-----
gregg.g.wonderly@att.com   (AT&T bell laboratories)

schmitz@hpscdc.HP.COM (John Schmitz) (06/10/89)

Re: suppressing blank lines after date when using mhl

> And try as I may I have been unable to suppress that blank line,
> anyonme got any helpful hints?

How's this?

*** mhlsbr.c.orig      Thu Jun 30 10:01:19 1988
--- mhlsbr.c    Fri Jun  9 16:48:20 1989
***************
*** 1001,1007
            cptr -> c_text = ap;

        (void) fmtscan (c1 -> c_fmt, buffer, sizeof buffer - 1, dat);
!       c2 -> c_text = concat (buffer, "\n", NULLCP);

        free (ap);
        return;

--- 1001,1009 -----
            cptr -> c_text = ap;

        (void) fmtscan (c1 -> c_fmt, buffer, sizeof buffer - 1, dat);
!       /* don't add the \n, please
!          c2 -> c_text = concat (buffer, "\n", NULLCP); */
!       c2 -> c_text = concat (buffer, "", NULLCP);

        free (ap);
        return;

No guarantee, but I was annoyed by this too, so I tried this just
now and it seems to work fine.

leres@ace.ee.lbl.gov (Craig Leres) (06/13/89)

Neil Davies wrote:
> Does anyone out there know how to suppress the blank line that follows any
> field used with the formatfield option, eg
>
>     Date:formatfield="%<(nodate{text})%{text}%|%(pretty{text})%>"
>     To:

gregg.g.wonderly wrote:
> The problem is more with dates than anything else.  Think of what ctime(3)
> returns and you will understand why.  The solution is a code modification to
> eliminate the newline from the buffer.

Actually, ctime(3) isn't used, a mh routine called dctime() is the one
that's adding the newline.

John Schmitz provided a working patch to mhlsbr.c. Still, I prefer
minimalistic changes so my patch is appended.

It's good to see so much interest in mh these days!

		Craig
------
RCS file: RCS/mhlsbr.c,v
retrieving revision 1.3
diff -c -r1.3 mhlsbr.c
*** /tmp/,RCSt1a10531	Mon Jun 12 17:11:12 1989
--- mhlsbr.c	Mon Jun 12 17:11:04 1989
***************
*** 952,958 ****
  	    cptr -> c_text = ap;

  	(void) fmtscan (c1 -> c_fmt, buffer, sizeof buffer - 1, dat);
! 	c2 -> c_text = concat (buffer, "\n", NULLCP);

  	free (ap);
  	return;
--- 952,959 ----
  	    cptr -> c_text = ap;

  	(void) fmtscan (c1 -> c_fmt, buffer, sizeof buffer - 1, dat);
! 	/* Don't need to append a newline, dctime() already did */
! 	c2 -> c_text = getcpy (buffer);

  	free (ap);
  	return;