Official patch #2 for mp v2.0; please apply it.
Rich Burridge
richb at sunchat.oz
Mon Apr 3 14:51:10 AEST 1989
[Note that official patch #1 was already applied when mp was posted to
comp.sources.misc.]
It fixes several problems, and added a few enhancements.
1/ Bug report and fix from Frederick M. Avolio <avolio%decuac.dec.com>
On printing mail, the date printed should be obtained from the Date:
line in the mail.
2/ Bug report from Fuat C. Baran <fuat%cunixc.cc.columbia.edu>
Bug report and fix from Frederick M. Avolio <avolio%decuac.dec.com>
Sometime the From: line is not the first header line. Mp has been
modified to handle all From lines as part of the DOHEADER automation
state.
3/ Bug report from Mark Prior <mrp at sirius.ua.oz.au>
It seems that when you print something within elm, the only headers
it provides are "From: ", "Subject: ", "To: " and "Date: ". This is
similar to the way the mh mail option with mp works, so a -elm flag
has been added, and the appropriate flag (mhflag) renamed to mh_elm.
The manual page has been updated. The front end shell script mailp,
has been modified accordingly.
4/ Bug report from Stephen Frede <stephen at softway.oz.au>
The manual entry says that the header and footer are printed in an
area of shaded stripes. On an Apple LaserWriter this is really a
pattern of dots. The manual page has been adjusted accordingly.
5/ Bug report and fix from Stephen Frede <stephen at softway.oz.au>
Fixes incorrect testing of the pointer returned from getlogin().
6/ If the -s "subject" option is given, this didn't override the
Subject: line in the mail item. This is now fixed.
7/ Enhancement from Craig Bishop <craig at charlie.oz.au>
Added the ability to compile mp so that MH mail or Elm mail is the
default. A definition was added to the Makefile, plus a -m flag, to
indicate normal mail formatting.
8/ Enhancement from Doug Buchanan <sun!sunehq!europe!douglas>
An attempt is made to extract the users' name for use in the header,
from the gcos field of the /etc/passwd file.
9/ Enhancement from Doug Buchanan <sun!sunehq!europe!douglas>
Support has been added for personal organisers' filofax and Time
Manager. [*IMPORTANT NOTE* I cannot get this to work properly on a
LaserWriter1, only on a LaserWriter+. I'd be interested to here from
anybody who succeeds with this. ]
Doug is adding in some improvements to this, so expect another patch
in the near future.
10/ Enhancement from Doug Buchanan <sun!sunehq!europe!douglas>
Two definitions can be included in via the comments at the beginning
of the prologue file:
%%PageLength xx
%%LineLength yy
11/ Enhancement from Craig Bishop <craig at charlie.oz.au>
Added a -from flag, to print mail that the user of mp has sent to
someone else. Just searches the To: line instead of the From: line.
Thanks to the above people for the bug reports, fixes, suggestions and
enhancements.
I've made some slight adjustments in some cases to the original code
that was supplied to me, in order to consolidate it with other fixes.
If this causes a problem, will the originator please let me know.
Feed this file to Larry Walls' patch program, then recompile.
Rich.
------CUT HERE------CUT HERE------
*** original/Makefile Thu Mar 30 16:53:11 1989
--- Makefile Mon Apr 3 14:45:37 1989
***************
*** 1,7 ****
#
# Makefile for mp, the PostScript pretty printer.
#
! # @(#)Makefile 1.2 88/12/28
#
# Original written in the Icon language by Steve Holden.
#
--- 1,7 ----
#
# Makefile for mp, the PostScript pretty printer.
#
! # @(#)Makefile 1.3 89/04/03
#
# Original written in the Icon language by Steve Holden.
#
***************
*** 16,21 ****
--- 16,24 ----
#
# Ordinary text file pretty printing by Rich Burridge.
#
+ # Personal Organiser printing style by Douglas Buchanan,
+ # Sun Microsystems Europe.
+ #
# Copyright (c) Steve Holden and Rich Burridge.
# All rights reserved.
#
***************
*** 35,40 ****
--- 38,49 ----
# Prologue file used with mp.
#
PROLOGUE = -DPROLOGUE=\"$(LIBDIR)/mp.pro.ps\"
+ #
+ # By default, mp expects normal formating of mail. Many sites however use
+ # MHmail or Elm mail. If your site is in this category, then uncomment the
+ # following definition.
+ #
+ #MH_ELM = -DMH_ELM=1
#---------------------------------------------------------------------
BINARIES = mp
***************
*** 42,51 ****
LIBDIR = /usr/local/lib
MANDIR = /usr/man/man$(MANSECT)
MANSECT = l
! CFLAGS = -g $(PROLOGUE)
OBJS = mp.o
SRCS = mp.c
! OTHERS = README Makefile mailp mp.pro.ps mp.1
all: $(BINARIES)
--- 51,61 ----
LIBDIR = /usr/local/lib
MANDIR = /usr/man/man$(MANSECT)
MANSECT = l
! CFLAGS = -g $(PROLOGUE) $(MH_ELM)
OBJS = mp.o
SRCS = mp.c
! OTHERS = README Makefile mailp mp.1 \
! mp.pro.ps mp.pro.filofax.ps mp.pro.timeman.ps mp.1
all: $(BINARIES)
***************
*** 56,61 ****
--- 66,73 ----
install -s -m 751 mp $(BINDIR)
install -c -m 644 mp.1 $(MANDIR)/mp.$(MANSECT)
install -c -m 644 mp.pro.ps $(LIBDIR)
+ install -c -m 644 mp.pro.filofax.ps $(LIBDIR)
+ install -c -m 644 mp.pro.timeman.ps $(LIBDIR)
backup:; cp $(SRCS) $(OTHERS) backdir
*** original/README Thu Mar 30 16:53:11 1989
--- README Mon Apr 3 14:45:37 1989
***************
*** 10,16 ****
in conjunction with a mail reading utility for producing a pretty print
of your mail items. It can be used with a news reading tool to pretty
print news articles. Digests can also be printed, and this version can
! pretty print ordinary ASCII files as well.
It uses a PostScript prologue file which normally resides in
/usr/local/lib, but this can be overwritten by use of the -p option.
--- 10,17 ----
in conjunction with a mail reading utility for producing a pretty print
of your mail items. It can be used with a news reading tool to pretty
print news articles. Digests can also be printed, and this version can
! pretty print ordinary ASCII files as well. Support for personal organiser
! printed was added with official patch #2.
It uses a PostScript prologue file which normally resides in
/usr/local/lib, but this can be overwritten by use of the -p option.
***************
*** 30,41 ****
which tidies up the user interface to mp. Dave Glowacki of Public Works
Computer Services, St Paul, MN. added the ability to print digests and
tidied up some of the other options. Rick Rodgers, UCSF School of Pharmacy,
! San Francicso revised the initial version of the mp manual page.
! Thanks go also to Bill Shannon, Roger De Salis, L. Jill Debord and David
! Fiedler for bug reports and/or bug fixes. I'm grateful to all these people,
! plus everybody who has suggested enhancements, and fixed bugs in the previous
! versions.
I welcome further bug reports and suggestions for improvements.
--- 31,43 ----
which tidies up the user interface to mp. Dave Glowacki of Public Works
Computer Services, St Paul, MN. added the ability to print digests and
tidied up some of the other options. Rick Rodgers, UCSF School of Pharmacy,
! San Francicso revised the initial version of the mp manual page. Doug
! Buchanan added support for printing in filofax and Time Manager format.
! Thanks go also to Bill Shannon, Roger De Salis, L. Jill Debord, Frederick
! Avolio, Mark Prior, Stephen Frede, Craig Bishop and David Fiedler for bug
! reports and/or bug fixes. I'm grateful to all these people, plus everybody
! who has suggested enhancements, and fixed bugs in the previous versions.
I welcome further bug reports and suggestions for improvements.
*** original/mailp Thu Mar 30 16:53:11 1989
--- mailp Mon Apr 3 14:45:38 1989
***************
*** 1,9 ****
#! /bin/sh
#
! # @(#)mailp 1.2 88/12/28
#
# mailp, newsp, filep, mhp and digestp
! # shell script de lancement de mp (mail/news/file pretty printer)
#
# Bruno Pillard - October 1988.
--- 1,10 ----
#! /bin/sh
#
! # @(#)mailp 1.3 89/04/03
#
# mailp, newsp, filep, mhp and digestp
! # shell script de lancement de mp
! # (mail/news/file/filofax/time-manager pretty printer)
#
# Bruno Pillard - October 1988.
***************
*** 12,20 ****
--- 13,24 ----
case $0 in
*mailp) PROG=mp ;;
*mhp) PROG="mp -mh" ;;
+ *elmp) PROG="mp -elm" ;;
*newsp) PROG="mp -n" ;;
*digestp) PROG="mp -d" ;;
*filep) PROG="mp -o" ;;
+ *filofax) PROG="mp -f -p /usr/local/lib/mp.pro.filofax.ps" ;;
+ *timeman) PROG="mp -t -p /usr/local/lib/mp.pro.timeman.ps" ;;
*) echo Unknown pretty printer: $0
exit;;
esac
*** original/mp.1 Thu Mar 30 16:53:12 1989
--- mp.1 Mon Apr 3 14:45:38 1989
***************
*** 1,4 ****
! .\" @(#)mp.1 1.2 88/12/28
.TH MP 1L "28 December 1988"
.SH NAME
mp \- Postscript pretty printer
--- 1,4 ----
! .\" @(#)mp.1 1.3 89/04/03
.TH MP 1L "28 December 1988"
.SH NAME
mp \- Postscript pretty printer
***************
*** 8,13 ****
--- 8,25 ----
.B \-d
]
[
+ .B \-elm
+ ]
+ [
+ .B \-f
+ ]
+ [
+ .B \-from
+ ]
+ [
+ .B \-m
+ ]
+ [
.B \-mh
]
[
***************
*** 25,30 ****
--- 37,45 ----
.I subject
]
[
+ .B \-t
+ ]
+ [
.B \-v
]
[
***************
*** 37,43 ****
which is a pretty print of the original. It is also possible to print
out complete mail folders and digests.
.LP
! The format adopted has shaded stripes containing banner information
at the top and bottom of every page. It is also possible to supply a
complete mail folder to be printed.
.LP
--- 52,58 ----
which is a pretty print of the original. It is also possible to print
out complete mail folders and digests.
.LP
! The format adopted has textured areas containing banner information
at the top and bottom of every page. It is also possible to supply a
complete mail folder to be printed.
.LP
***************
*** 60,65 ****
--- 75,93 ----
Source the
.B .mailrc
file again, and you are ready.
+ If the local default for mail at your site is
+ .B "MH Mail (1L)"
+ (see flag
+ .BR \-mh )
+ or
+ .B "Elm mail (1L)"
+ (see flag
+ .BR \-elm ),
+ the
+ .B .mailrc
+ commands above must use the
+ .B \-m
+ flag.
.LP
A useful alias to use used in conjunction with your
.I .cshrc
***************
*** 74,79 ****
--- 102,138 ----
.B \-d
The file on standard input is a digest so print accordingly.
.TP
+ .B \-elm
+ Use this flag, if the mail article on standard input comes from the
+ .B "Elm (1L)"
+ package, because the
+ .I From
+ mail header lines are of a slightly different format.
+ This should be the default at
+ .B Elm
+ sites.
+ .TP
+ .B \-f
+ The file on standard input is printed specifically was use with Filofax,
+ a personal organiser.
+ .TP
+ .B \-from
+ Use this flag if the mail article to be printed is from yourself.
+ If this flag is not used, several of the headers normally highlighted by
+ .B mp
+ will not be present.
+ .TP
+ .B \-m
+ Use if the mail article does not come from the
+ .B "MH Mail (1L)"
+ or
+ .B "Elm mail (1L)"
+ packages. This should be the default at non
+ .B MH
+ or
+ .B Elm
+ sites.
+ .TP
.B \-mh
Use if the mail article on standard input comes from the
.B "MH Mail (1L)"
***************
*** 80,85 ****
--- 139,147 ----
package, because the
.I From
mail header lines are of a slightly different format.
+ This should be the default at
+ .B MH
+ sites.
.TP
.B \-n
The file on standard input is a news article so print accordingly.
***************
*** 98,103 ****
--- 160,169 ----
.I " subject"
as the new subject for the printout.
.TP
+ .B \t
+ The file on standard input is printed specifically for use with Time Manager,
+ a personal organiser.
+ .TP
.B \-v
Print the version number of this release of the
.B mp
***************
*** 117,122 ****
--- 183,194 ----
PostScript prologue to define required vocabulary for mail printing.
Editing this file will allow you to introduce some stylistic variation
in the printing of mail.
+ .TP
+ .B /usr/local/lib/mp.pro.filofax.ps
+ Postscript prologue used to print out files in Filofax format.
+ .TP
+ .B /usr/local/lib/mp.pro.timeman.ps
+ PostScript prologue used to print out files in Time Manager format.
.SH "SEE ALSO"
mail(1)
.SH AUTHORS
***************
*** 129,131 ****
--- 201,206 ----
Handling of mail digests added by Dave Glowacki of Public Works Computer Services, St Paul, MN.
.br
Manual page for the initial version revised by Rick Rodgers, UCSF School of Pharmacy, San Francicso.
+ .br
+ Support for Personal Organiser printing style added by Douglas Buchanan,
+ Sun Microsystems Europe.
*** original/mp.c Thu Mar 30 16:53:12 1989
--- mp.c Mon Apr 3 14:45:36 1989
***************
*** 1,5 ****
#ifndef lint
! static char sccsid[] = "@(#)mp.c 1.4 89/01/03" ;
#endif
/* Takes a mail file, a news article or an ordinary file
--- 1,5 ----
#ifndef lint
! static char sccsid[] = "@(#)mp.c 1.5 89/04/03" ;
#endif
/* Takes a mail file, a news article or an ordinary file
***************
*** 18,23 ****
--- 18,26 ----
*
* Ordinary text file pretty printing by Rich Burridge.
*
+ * Personal Organiser printing style by Douglas Buchanan,
+ * Sun Microsystems Europe.
+ *
* Copyright (c) Steve Holden and Rich Burridge.
* All rights reserved.
*
***************
*** 36,42 ****
#include <time.h>
#include <pwd.h>
! #define PATCHLEVEL 1
#define FPRINTF (void) fprintf /* To make lint happy. */
#define PRINTF (void) printf
--- 39,45 ----
#include <time.h>
#include <pwd.h>
! #define PATCHLEVEL 2
#define FPRINTF (void) fprintf /* To make lint happy. */
#define PRINTF (void) printf
***************
*** 48,54 ****
enum print_type { PRINTMAIL, PRINTNEWS, PRINTORD } ;
/* States for the mail processing automation. */
- #define FROMLINE 0 /* Searching for the initial From line. */
#define DOHEADER 1 /* Processing rest of message header. */
#define DOMESSAGE 2 /* Processing text in message body. */
#define DOTEXT 3 /* Ordinary file - just print it. */
--- 51,56 ----
***************
*** 55,67 ****
#define EQUAL(val) !strncmp(val,nextline,strlen(val))
#define INC argc-- ; argv++ ;
! #define LINELENGTH 80 /* Number of characters per line. */
#define MAXLINE 256 /* Length of character strings. */
! #define PAGELENGTH 60 /* Number of lines per page. */
time_t time() ;
struct tm *localtime() ;
char *asctime(), *getlogin(), *gets() ;
char mf[MAXLINE] ; /* "[Mail,News,Listing] for ". */
char nextline[MAXLINE] ; /* Next line of the mail message. */
char progname[MAXLINE] ; /* Name of this program. */
--- 57,71 ----
#define EQUAL(val) !strncmp(val,nextline,strlen(val))
#define INC argc-- ; argv++ ;
! #define LINELENGTH 80 /* Default number of characters per line. */
#define MAXLINE 256 /* Length of character strings. */
! #define PAGELENGTH 60 /* Default number of lines per page. */
time_t time() ;
+ struct passwd *mypass ;
struct tm *localtime() ;
char *asctime(), *getlogin(), *gets() ;
+ char gecos[MAXLINE] ; /* Probably the real name to use */
char mf[MAXLINE] ; /* "[Mail,News,Listing] for ". */
char nextline[MAXLINE] ; /* Next line of the mail message. */
char progname[MAXLINE] ; /* Name of this program. */
***************
*** 73,87 ****
enum print_type ptype ; /* Type of printing to do. */
int digest = 0 ; /* Set if we are printing a mail digest. */
int lindex ; /* Index pointer to nextline. */
int linect = 0 ; /* Line count on current page. */
int maybe_more = 0 ; /* Message header continuation line indicator. */
! int mhflag = 0 ; /* Set if we are printing an MHmail message. */
int non_space ; /* Indicates if nextline has a non-space char. */
int pn = 1 ; /* Page number within message. */
int rec_line = 0 ; /* "Received:" line in message header. */
int removednl ; /* Set if a newline was removed from this line. */
int state ; /* Current state of the print automation. */
int tpn = 0 ; /* Total number of pages printed. */
--- 77,102 ----
enum print_type ptype ; /* Type of printing to do. */
int digest = 0 ; /* Set if we are printing a mail digest. */
+ int fflag = 0 ; /* Set if mail message is from the user. */
+ int filofax = 0 ; /* Set if we are printing a filofax file. */
int lindex ; /* Index pointer to nextline. */
int linect = 0 ; /* Line count on current page. */
+ int llen = LINELENGTH ; /* Number of characters per line. */
int maybe_more = 0 ; /* Message header continuation line indicator. */
!
! #ifdef MH_ELM
! int mh_elm = 1 ; /* Set if printing an MHmail or Elm message. */
! #else
! int mh_elm = 0 ;
! #endif MH_ELM
!
int non_space ; /* Indicates if nextline has a non-space char. */
+ int plen = PAGELENGTH ; /* Number of lines per page. */
int pn = 1 ; /* Page number within message. */
int rec_line = 0 ; /* "Received:" line in message header. */
int removednl ; /* Set if a newline was removed from this line. */
int state ; /* Current state of the print automation. */
+ int timeman = 0 ; /* Set if we are printing a Time Manager file. */
int tpn = 0 ; /* Total number of pages printed. */
***************
*** 90,95 ****
--- 105,112 ----
int argc ;
char **argv ;
{
+ char tmpstr[MAXLINE] ; /* Temporary variable. */
+ int t1, t2 ; /* Temporary variables. */
long clock ; /* Used by the localtime function call. */
struct tm *tm ; /* Used by the localtime and asctime calls. */
***************
*** 102,108 ****
FPRINTF(stderr,"%s: Prologue file not found.\n",progname) ;
exit(1) ;
}
! while (fgets(nextline,MAXLINE,pf) != NULL) PRINTF("%s",nextline) ;
defwrite("MailFor", mf) ; /* Output initial definitions. */
defwrite("User", username) ;
--- 119,133 ----
FPRINTF(stderr,"%s: Prologue file not found.\n",progname) ;
exit(1) ;
}
! while (fgets(nextline, MAXLINE, pf) != NULL)
! {
! PRINTF("%s", nextline) ; /* Check for new line or page length. */
! t1 = sscanf(nextline, "%s %d", tmpstr, &t2) ;
! if (strcmp(tmpstr, "%%PageLength") == 0)
! plen = t2 ; /* Change the page length. */
! else if (strcmp(tmpstr, "%%LineLength") == 0)
! llen = t2 ; /* Change the line length. */
! }
defwrite("MailFor", mf) ; /* Output initial definitions. */
defwrite("User", username) ;
***************
*** 113,121 ****
PRINTF("%%%%EndProlog\n") ;
if (ptype == PRINTORD) state = DOTEXT ;
! else state = FROMLINE ;
startpage() ;
! while (fgets(nextline,LINELENGTH+1,stdin) != NULL)
{
removednl = 0 ;
if (nextline[strlen(nextline)-1] == '\n')
--- 138,146 ----
PRINTF("%%%%EndProlog\n") ;
if (ptype == PRINTORD) state = DOTEXT ;
! else state = DOHEADER ;
startpage() ;
! while (fgets(nextline, llen+1, stdin) != NULL)
{
removednl = 0 ;
if (nextline[strlen(nextline)-1] == '\n')
***************
*** 132,138 ****
}
process() ;
}
! endpage() ;
PRINTF("%%%%Trailer\n") ;
PRINTF("%%%%Pages: %1d\n",tpn) ;
}
--- 157,164 ----
}
process() ;
}
! if (filofax || timeman) endfile() ;
! else endpage() ;
PRINTF("%%%%Trailer\n") ;
PRINTF("%%%%Pages: %1d\n",tpn) ;
}
***************
*** 156,161 ****
--- 182,194 ----
}
+ endfile()
+ {
+ linect = 0 ;
+ PRINTF("(%1d) endfile\n", pn) ;
+ }
+
+
endline()
{
PRINTF(") showline\n") ;
***************
*** 165,171 ****
endpage()
{
linect = 0 ;
! PRINTF("(%1d) endpage\n",pn++) ;
}
--- 198,204 ----
endpage()
{
linect = 0 ;
! PRINTF("(%1d) endpage\n", pn++) ;
}
***************
*** 172,178 ****
expand(s)
char *s ;
{
! int i,j,n ;
n = 0 ;
for (i = 0; i < strlen(s); i++)
--- 205,211 ----
expand(s)
char *s ;
{
! int eol, i, j, n ;
n = 0 ;
for (i = 0; i < strlen(s); i++)
***************
*** 196,205 ****
default : PRINTF("%c",s[i]) ;
n++ ;
}
! if (!(i % LINELENGTH) && i)
{
! endline() ;
! startline() ;
}
}
}
--- 229,243 ----
default : PRINTF("%c",s[i]) ;
n++ ;
}
! if (!(i % llen) && i)
{
! eol = 1 ;
! if (filofax || timeman) eol = tabled(s) ;
! if (eol)
! {
! endline() ;
! startline() ;
! }
}
}
}
***************
*** 217,224 ****
{
case 'd' : digest = 1 ; /* Print mail digest. */
break ;
! case 'm' : if (argv[0][2] == 'h') mhflag = 1 ; /* Handle MHmail. */
break ;
case 'n' : ptype = PRINTNEWS ; /* Print news article. */
STRCPY(mf, "News for ") ;
break ;
--- 255,272 ----
{
case 'd' : digest = 1 ; /* Print mail digest. */
break ;
! case 'e' : if (!strcmp(&argv[0][2], "lm"))
! mh_elm = 1 ; /* Handle Elm mail. */
break ;
+ case 'f' : if (argv[0][2] == NULL)
+ filofax = 1 ; /* Print filofax file. */
+ else if (!strcmp(&argv[0][2], "rom"))
+ fflag = 1 ; /* Mail from user. */
+ break ;
+ case 'm' : if (argv[0][2] == 'h')
+ mh_elm = 1 ; /* Handle MHmail. */
+ else if (argv[0][2] == NULL) mh_elm = 0 ;
+ break ;
case 'n' : ptype = PRINTNEWS ; /* Print news article. */
STRCPY(mf, "News for ") ;
break ;
***************
*** 245,258 ****
exit(1) ;
}
break ;
case 'v' : FPRINTF(stderr,"%s version 2.0.%1d\n",progname,PATCHLEVEL) ;
exit(1) ;
! case '?' : FPRINTF(stderr,"Usage: %s [-d] [-mh] [-n] [-o] [-p prologue] [-v] [-?]\n",
! progname) ;
! exit(1) ;
}
! argc-- ;
! argv++ ;
}
}
--- 293,305 ----
exit(1) ;
}
break ;
+ case 't' : timeman = 1 ; /* Print Time Manager file. */
+ break ;
case 'v' : FPRINTF(stderr,"%s version 2.0.%1d\n",progname,PATCHLEVEL) ;
exit(1) ;
! case '?' : usage() ;
}
! INC ;
}
}
***************
*** 260,265 ****
--- 307,313 ----
initialise() /* Set default values for various options. */
{
char *ptr ;
+ int i, spaces ;
struct passwd *pp ;
#ifdef PROLOGUE
***************
*** 269,276 ****
#endif
STRCPY(mf,"Mail for ") ; /* Assume mail as default. */
ptr = getlogin() ; /* Pointer to users login name. */
! if (ptr != NULL)
STRCPY(username, getlogin()) ; /* Users' login name. */
else /* Else get it from the passwd file. */
{
--- 317,325 ----
#endif
STRCPY(mf,"Mail for ") ; /* Assume mail as default. */
+ STRCPY(subject, "") ; /* Initially no subject line. */
ptr = getlogin() ; /* Pointer to users login name. */
! if (ptr != NULL && *ptr)
STRCPY(username, getlogin()) ; /* Users' login name. */
else /* Else get it from the passwd file. */
{
***************
*** 278,283 ****
--- 327,362 ----
if (pp == NULL) STRCPY(username, "printing") ;
else STRCPY(username, pp -> pw_name) ;
}
+
+ /* Have a look for the users gecos (normally real name), so that its a bit
+ * more recognisable. If the gecos is too long, then abbreviate to the first
+ * two words, assumed to be real name.
+ */
+
+ mypass = getpwnam(username) ;
+ if (mypass && mypass->pw_gecos)
+ {
+ STRCPY(username,mypass->pw_gecos) ;
+ if (strlen(username) > 17) /* Too long so truncate sensibly. */
+ {
+ i = 0 ;
+ spaces = 0 ;
+ while (i < 18)
+ {
+ if (username[i] == ' ')
+ {
+ spaces++ ;
+ if (spaces == 2)
+ {
+ username[i] = '\0' ; /* Truncate string. */
+ break ;
+ }
+ }
+ i++ ;
+ }
+ if (i == 18) username[18] = '\0' ;
+ }
+ }
ptype = PRINTMAIL ; /* Pretty print mail item by default. */
}
***************
*** 292,298 ****
PRINTF("BoldFont (%s) show PrimaryFont (",first) ;
expand(&s[strlen(first)]) ;
endline() ;
! if (!strcmp("Subject:",first))
{
PRINTF("/Subject (") ;
expand(&s[strlen(first)]) ;
--- 371,379 ----
PRINTF("BoldFont (%s) show PrimaryFont (",first) ;
expand(&s[strlen(first)]) ;
endline() ;
! if (!strcmp("Date:", first))
! defwrite("TimeNow", &s[strlen(first)]) ;
! if (!strcmp("Subject:",first) && !subject)
{
PRINTF("/Subject (") ;
expand(&s[strlen(first)]) ;
***************
*** 306,318 ****
{
switch (state)
{
- case FROMLINE : if (EQUAL(ptype == PRINTNEWS ?
- "From:" : (mhflag ? "From" : "From ")))
- {
- boldshow(nextline) ;
- state = DOHEADER ;
- }
- break ;
case DOHEADER : if (ptype == PRINTNEWS && EQUAL("Newsgroups"))
{
mixedshow(nextline) ;
--- 387,392 ----
***************
*** 319,325 ****
maybe_more = 0 ;
rec_line = 0 ;
}
! if (EQUAL(mhflag ? "From" : "From:") ||
EQUAL("Date") || EQUAL("Subject"))
{
mixedshow(nextline) ;
--- 393,406 ----
maybe_more = 0 ;
rec_line = 0 ;
}
! if (EQUAL(ptype == PRINTNEWS ?
! "From:" : (mh_elm ? "From" : "From ")))
! {
! if (!fflag) boldshow(nextline) ;
! else mixedshow(nextline) ;
! maybe_more = 0 ;
! }
! if (EQUAL(mh_elm ? "From" : "From:") ||
EQUAL("Date") || EQUAL("Subject"))
{
mixedshow(nextline) ;
***************
*** 326,333 ****
maybe_more = 0 ;
rec_line = 0 ;
}
! else if (EQUAL("To") || EQUAL("Cc"))
{
mixedshow(nextline) ;
maybe_more = 1 ;
rec_line = 0 ;
--- 407,421 ----
maybe_more = 0 ;
rec_line = 0 ;
}
! else if (EQUAL("To"))
{
+ if (fflag) boldshow(nextline) ;
+ else mixedshow(nextline) ;
+ maybe_more = 1 ;
+ rec_line = 0 ;
+ }
+ else if (EQUAL("Cc"))
+ {
mixedshow(nextline) ;
maybe_more = 1 ;
rec_line = 0 ;
***************
*** 352,358 ****
break ;
case DOMESSAGE : if (digest && (EQUAL("Date: ") || EQUAL("From: ")))
{
! linect = PAGELENGTH ;
useline() ;
mixedshow(nextline) ;
state = DOHEADER ;
--- 440,446 ----
break ;
case DOMESSAGE : if (digest && (EQUAL("Date: ") || EQUAL("From: ")))
{
! linect = plen ;
useline() ;
mixedshow(nextline) ;
state = DOHEADER ;
***************
*** 359,365 ****
}
else if (EQUAL("From ") && (ptype == PRINTMAIL))
{
! linect = PAGELENGTH ;
useline() ;
pn = 1 ;
boldshow(nextline) ;
--- 447,453 ----
}
else if (EQUAL("From ") && (ptype == PRINTMAIL))
{
! linect = plen ;
useline() ;
pn = 1 ;
boldshow(nextline) ;
***************
*** 386,391 ****
--- 474,494 ----
}
+ tabled(s) /* Check for 'tabled' lines. */
+ char *s ;
+ {
+ int i ;
+
+ for (i = 0; i <strlen(s); i++)
+ {
+ if (s[i] == '\t') return(0) ;
+ if ((i < strlen(s) - 3) && (s[i] == ' ') &&
+ (s[i+1] == ' ') && (s[i] == ' ')) return(0) ;
+ }
+ return(1) ;
+ }
+
+
textshow(s)
char *s ;
{
***************
*** 393,399 ****
{
if (removednl) /* Is this the bogus formfeed at the end? */
{
! linect = PAGELENGTH ;
useline() ;
}
return ;
--- 496,502 ----
{
if (removednl) /* Is this the bogus formfeed at the end? */
{
! linect = plen ;
useline() ;
}
return ;
***************
*** 405,413 ****
}
useline()
{
! if (++linect > PAGELENGTH)
{
endpage() ;
startpage() ;
--- 508,524 ----
}
+ usage() /* Print usage message and exit. */
+ {
+ FPRINTF(stderr,"Usage: %s [-d] [-elm] [-f] [-from] [-m] [-mh] ", progname) ;
+ FPRINTF(stderr, "[-n] [-o] [-p prologue] [-t] [-v] [-?]\n") ;
+ exit(1) ;
+ }
+
+
useline()
{
! if (++linect > plen)
{
endpage() ;
startpage() ;
*** original/mp.pro.filofax.ps Thu Mar 30 16:53:12 1989
--- mp.pro.filofax.ps Thu Mar 30 16:53:19 1989
***************
*** 0 ****
--- 1,173 ----
+ %!PS-Adobe-1.0
+ %%Creator: Steve Holden
+ %%Modifed: Rich Burridge
+ %%Title: @(#)mp.pro.filofax.ps 1.1 89/03/20
+ %%CreationDate: see above
+ %%PageLength 66
+ %%LineLength 80
+ %%DocumentFonts: Times-Bold Times-Roman Courier
+ %%Pages: (atend)
+ %%EndComments
+
+ /font1d /Times-Bold findfont 11 scalefont def
+ /font2d /Times-Roman findfont 11 scalefont def
+ /font3d /Courier findfont 10 scalefont def
+ /fontHd /Helvetica-BoldOblique findfont 15 scalefont def
+ /fontH2 /Helvetica-BoldOblique findfont 10 scalefont def
+ /fontNd /Times-Bold findfont 12 scalefont def
+
+ /BoldFont { font1d setfont } def
+ /PrimaryFont { font2d setfont } def
+ /SecondaryFont { font3d setfont } def
+ /fontH { fontHd setfont } def
+ /fontD { fontH2 setfont } def
+ /fontN { fontNd setfont } def
+
+ SecondaryFont
+ %% stick in all the fudge factors here. May need changing for page sizes,
+ %% laserwriter setups etc?
+ %%
+ /binderspace 100 def
+ /filowidth 484 def
+ /filoheight 972 def
+ /margin 12 def
+ /xleft binderspace 6 add def
+ /yco filoheight 50 sub def % space at the top
+ /xright filowidth binderspace add 30 sub def % space at right
+
+ /endpage
+ {
+ gsave
+ fontH
+ % draw the top for owner
+ newpath
+ xleft 10 sub yco moveto
+ xleft yco 20 sub 10 180 270 arc
+ xright yco 20 sub 10 270 0 arc
+ xright yco 10 0 90 arc
+ xleft yco 10 90 180 arc
+ closepath
+ 0.90 setgray fill
+ % newpath
+ % 318 864 15 0 360 arc
+ % gsave
+ % 1 setgray fill
+ % grestore
+ % closepath
+ 0 setgray stroke
+ xleft yco 16 sub moveto
+ MailFor show
+ User show
+ fontD
+ TimeNow stringwidth pop neg xright add yco 16 sub moveto TimeNow show
+ fontN
+ % dup stringwidth pop 2 div neg 318 add 858 moveto show
+ fontH
+ % lower box for subject etc
+ newpath
+ xleft 10 sub 60 moveto
+ xleft 40 10 180 270 arc
+ xright 40 10 270 0 arc
+ xright 60 10 0 90 arc
+ xleft 60 10 90 180 arc
+ closepath
+ 0.90 setgray fill
+ % stick the page number just a few points in from the right hand edge
+ newpath
+ xright 10 sub 50 15 0 360 arc
+ gsave
+ 1 setgray fill
+ grestore
+ closepath
+ 0 setgray stroke
+ xleft 44 moveto Subject show
+ fontN
+ % position and print the page number
+ dup stringwidth pop 2 div neg xright 10 sub add 46 moveto show
+ fontH
+ grestore
+ modu 2 eq eof 0 ne or { showpage } if % do a 'form feed'
+ % if ready for it
+ eof 0 eq { newpage } if % reset parameters for next if not end of file
+ } def
+
+ /endfile
+ {
+ /eof 1 def
+ endpage
+ } def
+
+ /xo 36 def
+ /yo 0 def
+ /pageno 0 def
+ /modu pageno 3 mod def % get mod to work out page pos
+ /eof 0 def
+
+ /weearc % draws a little arc to show where the holes go
+ { newpath
+ xo yo 4 0 360 arc
+ closepath
+ fill
+ } def
+
+ /filopage
+ { gsave
+ % 24 -118 translate
+ /xstart filowidth modu mul def
+ /xstart xstart binderspace add def
+ /xfin xstart filowidth add def
+ modu 0 eq { % first break
+ /yo 130 def % show where the holes should be punched
+ weearc % except that they will normally be off the edge of
+ /yo 238 def % the page
+ weearc
+ /yo 346 def
+ weearc
+ /yo 639 def
+ weearc
+ /yo 742 def
+ weearc
+ /yo 850 def
+ weearc
+ } if
+ [1 4] 0 setdash % use dashed lines for marker
+ newpath
+ xstart 0 moveto
+ xfin 0 lineto
+ xfin filoheight lineto
+ stroke
+ grestore
+ } def
+
+ /newpage
+ {
+ pageno 0 eq { % set initial values for landscape drawing
+ 0.5 0.5 scale
+ 90 rotate
+ -50 0 translate
+ gsave % save state for easy restore
+ /eof 0 def
+ } {
+ grestore gsave % return to preferred original state
+ } ifelse % initial setup
+
+ /modu pageno 3 mod def % get mod to work out page pos
+ 0 0 filoheight sub translate % initial position (-filoheight)
+ filopage % draw neccessary page breaks
+ /times filowidth modu mul def % shift origin as far right as needed
+ /times times margin add def % move right by fudge factor 12
+ times 0 translate
+ /lct 0 def
+ /ypos filoheight 110 sub def
+ xleft ypos moveto
+ /pageno pageno 1 add def % add one for the next time
+ } def
+
+ /showline
+ {
+ show
+ /ypos ypos 12 sub def
+ xleft ypos moveto
+ } def
+
+ newpage % establish first page parameters
*** original/mp.pro.timeman.ps Thu Mar 30 16:53:12 1989
--- mp.pro.timeman.ps Thu Mar 30 16:53:19 1989
***************
*** 0 ****
--- 1,173 ----
+ %!PS-Adobe-1.0
+ %%Creator: Steve Holden
+ %%Modifed: Rich Burridge
+ %%Title: @(#)mp.pro.timeman.ps 1.1 89/03/20
+ %%CreationDate: see above
+ %%PageLength 66
+ %%LineLength 80
+ %%DocumentFonts: Times-Bold Times-Roman Courier
+ %%Pages: (atend)
+ %%EndComments
+
+ /font1d /Times-Bold findfont 12 scalefont def
+ /font2d /Times-Roman findfont 12 scalefont def
+ /font3d /Courier findfont 11 scalefont def
+ /fontHd /Helvetica-BoldOblique findfont 15 scalefont def
+ /fontH2 /Helvetica-BoldOblique findfont 10 scalefont def
+ /fontNd /Times-Bold findfont 12 scalefont def
+
+ /BoldFont { font1d setfont } def
+ /PrimaryFont { font2d setfont } def
+ /SecondaryFont { font3d setfont } def
+ /fontH { fontHd setfont } def
+ /fontD { fontH2 setfont } def
+ /fontN { fontNd setfont } def
+
+ SecondaryFont
+ %% stick in all the fudge factors here. May need changing for page sizes,
+ %% laserwriter setups etc?
+ %%
+ /binderspace 100 def
+ /filowidth 520 def
+ /filoheight 1024 def
+ /margin 12 def
+ /xleft binderspace 6 add def
+ /yco filoheight 50 sub def % space at the top
+ /xright filowidth binderspace add 30 sub def % space at right
+
+ /endpage
+ {
+ gsave
+ fontH
+ % draw the top for owner
+ newpath
+ xleft 10 sub yco moveto
+ xleft yco 20 sub 10 180 270 arc
+ xright yco 20 sub 10 270 0 arc
+ xright yco 10 0 90 arc
+ xleft yco 10 90 180 arc
+ closepath
+ 0.90 setgray fill
+ % newpath
+ % 318 864 15 0 360 arc
+ % gsave
+ % 1 setgray fill
+ % grestore
+ % closepath
+ 0 setgray stroke
+ xleft yco 16 sub moveto
+ MailFor show
+ User show
+ fontD
+ TimeNow stringwidth pop neg xright add yco 16 sub moveto TimeNow show
+ fontN
+ % dup stringwidth pop 2 div neg 318 add 858 moveto show
+ fontH
+ % lower box for subject etc
+ newpath
+ xleft 10 sub 60 moveto
+ xleft 40 10 180 270 arc
+ xright 40 10 270 0 arc
+ xright 60 10 0 90 arc
+ xleft 60 10 90 180 arc
+ closepath
+ 0.90 setgray fill
+ % stick the page number just a few points in from the right hand edge
+ newpath
+ xright 10 sub 50 15 0 360 arc
+ gsave
+ 1 setgray fill
+ grestore
+ closepath
+ 0 setgray stroke
+ xleft 44 moveto Subject show
+ fontN
+ % position and print the page number
+ dup stringwidth pop 2 div neg xright 10 sub add 46 moveto show
+ fontH
+ grestore
+ modu 2 eq eof 0 ne or { showpage } if % do a 'form feed'
+ % if ready for it
+ eof 0 eq { newpage } if % reset parameters for next if not end of file
+ } def
+
+ /endfile
+ {
+ /eof 1 def
+ endpage
+ } def
+
+ /xo 36 def
+ /yo 0 def
+ /pageno 0 def
+ /modu pageno 3 mod def % get mod to work out page pos
+ /eof 0 def
+
+ /weearc % draws a little arc to show where the holes go
+ { newpath
+ xo yo 4 0 360 arc
+ closepath
+ fill
+ } def
+
+ /filopage
+ { gsave
+ % 24 -118 translate
+ /xstart filowidth modu mul def
+ /xstart xstart binderspace add def
+ /xfin xstart filowidth add def
+ modu 0 eq { % first break
+ /yo 130 def % show where the holes should be punched
+ weearc % except that they will normally be off the edge of
+ /yo 238 def % the page
+ weearc
+ /yo 346 def
+ weearc
+ /yo 639 def
+ weearc
+ /yo 742 def
+ weearc
+ /yo 850 def
+ weearc
+ } if
+ [1 4] 0 setdash % use dashed lines for marker
+ newpath
+ xstart 0 moveto
+ xfin 0 lineto
+ xfin filoheight lineto
+ stroke
+ grestore
+ } def
+
+ /newpage
+ {
+ pageno 0 eq { % set initial values for landscape drawing
+ 0.5 0.5 scale
+ 90 rotate
+ -50 0 translate
+ gsave % save state for easy restore
+ /eof 0 def
+ } {
+ grestore gsave % return to preferred original state
+ } ifelse % initial setup
+
+ /modu pageno 3 mod def % get mod to work out page pos
+ 0 0 filoheight sub translate % initial position (-filoheight)
+ filopage % draw neccessary page breaks
+ /times filowidth modu mul def % shift origin as far right as needed
+ /times times margin add def % move right by fudge factor 12
+ times 0 translate
+ /lct 0 def
+ /ypos filoheight 110 sub def
+ xleft ypos moveto
+ /pageno pageno 1 add def % add one for the next time
+ } def
+
+ /showline
+ {
+ show
+ /ypos ypos 12 sub def
+ xleft ypos moveto
+ } def
+
+ newpage % establish first page parameters
More information about the Comp.sources.bugs
mailing list