[net.bugs.4bsd] reading Mail with more

david (04/07/83)

A few weeks ago I asked if anyone had ever solved the problem of reading
long messages (more than one screenful) in Mail (Berkeley Mail).
I didn't receive any replies, so I went ahead and did it myself. Now when
reading mail, if the article is longer than 23 lines, it gets piped through
more.
The change was quite simple, though one could make it fancier (get PAGER and
PAGESIZE from the environment or from .mailrc and /usr/lib/Mail.rc, etc.).  
I have made this change on both our VAX 11/780 running 4.1BSD and our 
PDP11/70 running 2.8BSD; we've been running it for several days without
problems.  I'd appreciate hearing any comments or problems anyone may
encounter.

While looking through the code, I discovered an undocumented command:
	z+ will display the next page of the table of contents
	z- will display the previous page
This is of use only if you have more than 18 articles in your mail queue.

	David Brown
	Varian Instruments
	2700 Mitchell Dr.
	Walnut Creek, Ca. 94598
	(415) 939-2400
	...!decvax!sytek!zehntel!varian!david
	...!ucbvax!menlo70!sytek!zehntel!varian!david
	...!tektronix!zehntel!varian!david
	...!fortune!varian!david

-------

In /usr/src/cmd/ucbmail/cmd1.c:

in routine print():
change at line 227:
 	send(mp, stdout);
to:
 	sendpage(mp, stdout);

and add at the end a new routine sendpage(), which is a modification
of the send routine in send.c:

#define PAGER "/usr/ucb/more"
#define PAGESIZE 23
sendpage(mailp, obuf)
	struct message *mailp;
	FILE *obuf;
{
	register struct message *mp;
	register int t;
	unsigned int c;
	FILE *ibuf;
	int lc;
	FILE *pfp, *popen();

	mp = mailp;
	ibuf = setinput(mp);
	c = msize(mp);
	if (mp->m_lines > PAGESIZE) {
		fflush(obuf);
		pfp = popen(PAGER,"w");
		if (pfp == NULL)
			pfp = obuf;
	}
	else
		pfp = obuf;
	while (c-- > 0) {
		putc(t = getc(ibuf), pfp);
		if (t == '\n')
			lc++;
	}
	if (pfp != obuf)
		pclose(pfp);
	return(lc);
}

pn (04/09/83)

Hmm, I didn't see your original article or I would have told you that in
our version of Mail (2.15) you can say "set crt=23" and any letters
longer than 23 get piped through "more". I don't remember if the pager
is selectable or not. It also has the concept of folders to make the
maintenance of a mailbox per subject very easy. If I send a letter to
James Gosling about emacs, I can CC +gosling and a copy will be placed
in my gosling folder. Similarly I can S +gosling and save his reply in
my gosling folder. UCB is working on 2.18 so I am several releases behind,
but 2.15 works pretty well, with only a few (fixed in 2.17) innocent bugs.

Please mention the version of software you have in any bug reports.

msc (04/09/83)

	The diffs for ucbmail that went out with news B v2.3 and, I think
	v2.6, change Mail so that long messages are piped through more(1).

	All you need do (besides running the diffs and installing the new
	Mail) is to set a variable called "crt" either in your evnvironment
	or with a command in your .mailrc file.  This variable should be
	set to the number of lines on your crt.

	I have run these diff's against Mail and we have been using the
	new version for several months.  The diff's make several other
	changes as well and I vastly prefer the new version.

				Mark Callow
				...{decvax,ucbvax}!decwrl!qubix!msc
				...ittvax!qubix!msc
				decwrl!qubix!msc@Berkeley.ARPA