From: utzoo!decvax!ucbvax!ucbcad:tektronix!zehntel!varian!david Newsgroups: net.unix-wizards,net.bugs.4bsd,net.bugs.2bsd Title: reading Mail with more Article-I.D.: varian.141 Posted: Thu Apr 7 15:09:12 1983 Received: Sat Apr 9 08:25:47 1983 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); }