[comp.sources.bugs] Official patch #14 for mp v2.4; please apply it.

richb@sunaus.oz (Rich Burridge) (11/01/90)

This is official patch #14 for mp v2.4.

The intent of this patch is to get v2.4 into a final stable state.
It fixes all the niggly little problems, and unless I've made any
stupid mistakes, will be the last patch for v2.4.

I'm now going to start putting together a new release. As well as
including a completely revised mp.pro.ps file from John Macdonald,
and a new version of the manual pages from Rick Rodgers, I'll be trying
to include some of the suggestions currently in the TODO file. If you've
got any more suggestions or you've added features locally, then
please feel free to send them on to me, and I'll include them in the
general released version.


CONTENTS:

1. What is mp?
2/ Changes made in this patch.
3/ How to install this patch.
4/ How to get previous patches.

----------------

1/ What is mp?

Mp is a Postscript pretty printer for mail,news and ordinary files.
Mp v2.4 was posted to comp.sources.misc about three months ago at
patchlevel #5.

----------------

2/ Changes made in this patch.

    *  From Amos Shapir <amos@nsc.nsc.com>
       From Felix Ingrand <felix@ai.sri.com>
       From Mike Khaw <khaw@parcplace.com>
       From Ken Hayman <hayman@itd.nrl.navy.mil>
       From John Macdonald <mtxinu!uunet.UU.NET!jmm%eci386@Sun.COM>
       mp was no longer correctly recognising "from " header lines. This was
       a bug in hdr_equal(), and affected the default mode of mail printing.
       I've used a replacement hdr_equal() routine from Amos, which only
       scans the string once instead of four times.

    *  From Mike Khaw <khaw@parcplace.com>
       From yonkers@ncsc.org
       In our environment the "newfile" code causes the Apple laserwriter NTX's
       to barf. This is a page reversal problem, with the PostScript routine
       newfile being undefined. All references to newfile and endfile have
       been removed from the prologue files and the mp program. The routine
       startfile() has been left in as a null routine for now.

    *  From Ian Hoyle <ianh@bhpmrl.oz.au>
       There is a problem with allocation of memory via the realloc calls in
       print.c, on an SGI box running Irix 3.2, due to rounding. I'm simply
       allocated one extra byte in each of the realloc calls.

    *  From John Macdonald <mtxinu!uunet.UU.NET!jmm%eci386@Sun.COM>
       Now that mp is case insensitive about mail headers, it was possible for
       mail digests (ala comp.risks) and mail folders to be incorrectly
       processed. If mp was finding a line beginning with "from ", it was
       taking this as the start of a new message. A check has been added to
       the folder and digest processing in printfile() in main.c, to only
       proceed with new message processing, if the line in question matches
       the test criteria *and* the first character is upper-case.

    *  From Francois Ougier <ougier@saphir.cl.bull.fr>
       Just like pageno, colct should be reset (to 0) when looping for
       argument files in main.c (line 164). Otherwise, when printing multiple
       ascii files in landscape mode, the second column of each first page is
       always empty..

    *  From Francois Ougier <ougier@saphir.cl.bull.fr>
       The README file has been changed to suggest that a page length of 70
       might be more useful to A4 sites, rather than 72, and to include that
       86 seems a good value for LineLength in landscape mode for A4 paper.

----------------

3/ How to install this patch.

Apply the patch with Larry Wall's patch program. Then do a "make". If your
site uses US Letter paper size, then do a "make install". If your site uses
A4 paper size, then do a "make install-a4". You will probably have to be
super-user to do this.

----------------

4/ How to get previous patches.

If you need to get patches 6-13, then they can be obtained from the automatic
mail archive server, by sending a message to rb-archive-server@Aus.Sun.COM
containing the line:

send mp patchn

where n is the patch number you require.

The latest complete mp distribution (fully patched) can be obtained from the
same address, by sending a message containing the lines:

send mp part1
send mp part2
          
If the mail is likely to go back through any sites that impose a size limit,
then I suggest you divide the above request up into two separate mail
messages. 
          
You can also include a path line in these requests to indicate the mail
path that the archive server should use to send the files to you. Such a
path line could be:
          
path uunet.uu.net!hostname!user
          
Note that this is uunet.uu.net and not just uunet. Sun.COM doesn't recognise
just uunet.

[NOTE: When unpacking the shars generated by the automatic mail service,
       it is possible you will get error messages for incorrect length.
       Please ignore; hopefully the files should still unpack correctly].
 
Rich Burridge,          DOMAIN: richb@Aus.Sun.COM
Sun Microsystems.       ACSNET: richb@sunaus.sun.oz
PHONE: +61 2 413 2666   UUCP:   {uunet,mcvax,ukc}!munnari!sunaus.oz!richb
 
------CUT HERE------patch.14------CUT HERE------

------- patchlevel.h -------
Prereq: 13
*** /tmp/da02812	Thu Nov  1 15:25:21 1990
--- patchlevel.h	Wed Oct 10 10:57:29 1990
***************
*** 14,17 ****
   *  reported to me then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  13
--- 14,17 ----
   *  reported to me then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  14

------- README -------
*** /tmp/da02787	Thu Nov  1 15:25:14 1990
--- README	Thu Nov  1 15:22:40 1990
***************
*** 62,68 ****
  It is possible to change the number of lines printed per page, by
  adjusting the %%PageLength value in the initial portion of each of the
  PostScript prologue files. For example, with the default prologue file
! mp.pro.ps, A4 size paper users might find a page length of 72 more useful.
  
  Before you install the mp files in the appropriate places, you should
  consider whether you want the installation to install the newsp, filep ...
--- 62,69 ----
  It is possible to change the number of lines printed per page, by
  adjusting the %%PageLength value in the initial portion of each of the
  PostScript prologue files. For example, with the default prologue file
! mp.pro.ps, A4 size paper users might find a page length of 70 more useful,
! and 86 seems a good value for LineLength in landscape mode.
  
  Before you install the mp files in the appropriate places, you should
  consider whether you want the installation to install the newsp, filep ...
***************
*** 160,167 ****
  Amos Shapir, Bruce G Barnett, Pauline van Winsen, James F. Blake, Bruno
  Pillard, Rainer Klute, Ran Ever-Hadani, Lupe Christoph, John Little, Bill
  Houle, Paul Eggert, Larry W. Virden, Peter Collinson, Jim Sanchez, Ian
! Young, Andreas Wettengel, Sato Toshihiko, Geoff Mulligan, Andy Norman and
! Paul Higgins for bug reports and/or bug fixes plus enhancements.
  
  My thanks also goes to Glenn Reid from Adobe Systems for the backspacefont.ps
  code used in the prologue files. I'm grateful to all these people, plus
--- 161,169 ----
  Amos Shapir, Bruce G Barnett, Pauline van Winsen, James F. Blake, Bruno
  Pillard, Rainer Klute, Ran Ever-Hadani, Lupe Christoph, John Little, Bill
  Houle, Paul Eggert, Larry W. Virden, Peter Collinson, Jim Sanchez, Ian
! Young, Andreas Wettengel, Sato Toshihiko, Geoff Mulligan, Andy Norman, Paul
! Higgins, Felix Ingrand, John Macdonald, Ian Hoyle and Francois Ougier for bug
! reports and/or bug fixes plus enhancements.
  
  My thanks also goes to Glenn Reid from Adobe Systems for the backspacefont.ps
  code used in the prologue files. I'm grateful to all these people, plus

------- mp.pro.ps -------
*** /tmp/da02790	Thu Nov  1 15:25:15 1990
--- mp.pro.ps	Thu Nov  1 13:52:04 1990
***************
*** 102,117 ****
    showpage              % display it
  } def
  
- /newfile
- {
-   /FileSave save def 	% file-level save...
- } def
- 
- /endfile
- {
-   FileSave restore	% ...and restore
- } def
- 
  /endcol			% page_number col_number endcol --
  {
    pop			% get rid of col_number
--- 102,107 ----

------- mp.pro.ff.ps -------
*** /tmp/da02793	Thu Nov  1 15:25:15 1990
--- mp.pro.ff.ps	Thu Nov  1 13:51:50 1990
***************
*** 85,100 ****
    grestore
  } def
  
- /newfile
- {
-   /FileSave save def    % file-level save...
- } def
- 
- /endfile
- {
-   FileSave restore      % ...and restore
- } def
- 
  /endcol			% page_number column_number endcol --
  {
    /thiscol exch def	% column_number
--- 85,90 ----

------- mp.pro.tm.ps -------
*** /tmp/da02796	Thu Nov  1 15:25:16 1990
--- mp.pro.tm.ps	Thu Nov  1 13:52:09 1990
***************
*** 85,100 ****
    grestore
  } def
  
- /newfile
- {
-   /FileSave save def    % file-level save...
- } def
- 
- /endfile
- {
-   FileSave restore      % ...and restore
- } def
- 
  /endcol			% page_number column_number endcol --
  {
    /thiscol exch def	% column_number
--- 85,90 ----

------- header.c -------
*** /tmp/da02799	Thu Nov  1 15:25:17 1990
--- header.c	Thu Nov  1 13:26:12 1990
***************
*** 68,84 ****
  hdr_equal(val)
  char val[MAXLINE] ;
  {
!   char token[MAXLINE], word[MAXLINE] ;
!   char *nptr = nextline ;
!   char *wptr = word ;
  
!   STRCPY(token, val) ;
!   if (isupper(token[0])) token[0] = tolower(token[0]) ;
!   while (*nptr && *nptr != ' ')
!     if (isupper(*nptr)) *wptr++ = tolower(*nptr++) ;
!     else                *wptr++ = *nptr++ ;
!   *wptr = '\0' ;
!   return(!strncmp(token, word, strlen(token))) ;
  }
  
  
--- 68,87 ----
  hdr_equal(val)
  char val[MAXLINE] ;
  {
!   register char *nptr = nextline ;
!   register char *wptr = val ;
!   register int n, w ;
  
!   do
!     {
!       n = *nptr++ ;
!       w = *wptr++ ;
!       if (isupper(n)) n = tolower(n) ;
!       if (isupper(w)) w = tolower(w) ;
!       if (n != w && w != '\0') return(0) ;
!     }
!   while (n != '\0' && w != '\0') ;
!   return(1) ;
  }
  
  

------- main.c -------
*** /tmp/da02802	Thu Nov  1 15:25:18 1990
--- main.c	Thu Nov  1 15:12:03 1990
***************
*** 162,167 ****
--- 162,168 ----
              FPRINTF(stderr, "%s: cannot open %s\n", progname, curfname) ;
              continue ;
            }
+         colct = 0 ;
          pageno = 1 ;       /* Initialise current page number. */
          end_of_file = 0 ;  /* Reset in case there's another file to print. */
          printfile() ;      /* Pretty print current file. */
***************
*** 205,211 ****
            blankslate = 0 ;
          }
  
!       if (folder && hdr_equal(FROM_HDR))
          {
            linect = plen ;
            reset_headers() ;
--- 206,212 ----
            blankslate = 0 ;
          }
  
!       if (folder && hdr_equal(FROM_HDR) && isupper(nextline[0]))
          {
            linect = plen ;
            reset_headers() ;
***************
*** 212,219 ****
            parse_headers(FALSE) ;
            show_headers(FALSE) ;
          }
!       if (digest && (hdr_equal(FROMHDR) ||
!                      hdr_equal(DATEHDR) || hdr_equal(SUBJECTHDR)))
          {
            linect = plen ;
            parse_headers(TRUE) ;
--- 213,221 ----
            parse_headers(FALSE) ;
            show_headers(FALSE) ;
          }
!       if (digest &&
!          (hdr_equal(FROMHDR) || hdr_equal(DATEHDR) || hdr_equal(SUBJECTHDR)) &&
!           isupper(nextline[0]))
          {
            linect = plen ;
            parse_headers(TRUE) ;

------- print.c -------
*** /tmp/da02806	Thu Nov  1 15:25:19 1990
--- print.c	Thu Nov  1 14:20:36 1990
***************
*** 40,46 ****
  endfile()
  {
    linect = 0 ;
-   PRINTF("endfile\n") ;
  }
  
  
--- 40,45 ----
***************
*** 127,133 ****
        for (i = 0; i < strlen(newsgroups); i++)
          if (newsgroups[i] == ',' ||
              newsgroups[i] == '\0') break ;
!       owner = (char *) realloc(owner, (unsigned int) i) ;
        STRNCPY(owner, newsgroups, i) ;
        owner[i] = '\0' ;
      }
--- 126,132 ----
        for (i = 0; i < strlen(newsgroups); i++)
          if (newsgroups[i] == ',' ||
              newsgroups[i] == '\0') break ;
!       owner = (char *) realloc(owner, (unsigned int) i+1) ;
        STRNCPY(owner, newsgroups, i) ;
        owner[i] = '\0' ;
      }
***************
*** 134,140 ****
    else if (print_orig == TRUE && from != NULL)
      {
        i = strlen(from) ;
!       owner = (char *) realloc(owner, (unsigned int) i) ;
        STRNCPY(owner, from, i) ;
        owner[i] = '\0' ;
      }
--- 133,139 ----
    else if (print_orig == TRUE && from != NULL)
      {
        i = strlen(from) ;
!       owner = (char *) realloc(owner, (unsigned int) i+1) ;
        STRNCPY(owner, from, i) ;
        owner[i] = '\0' ;
      }
***************
*** 197,203 ****
  
  startfile()
  {
-   PRINTF("newfile\n") ;
  }
  
  
--- 196,201 ----

------- CHANGES -------
*** /tmp/da02809	Thu Nov  1 15:25:20 1990
--- CHANGES	Thu Nov  1 15:21:50 1990
***************
*** 471,473 ****
--- 471,518 ----
  
      *  From Larry Virden <lwv27%CAS@pucc.PRINCETON.EDU>
         Specifying "mp -o -F <mailfile" causes mp to dump core.
+ 
+ v2.4 - patchlevel 14. - 1st November 1990.
+ 
+     *  From Amos Shapir <amos@nsc.nsc.com>
+        From Felix Ingrand <felix@ai.sri.com>
+        From Mike Khaw <khaw@parcplace.com>
+        From Ken Hayman <hayman@itd.nrl.navy.mil>
+        From John Macdonald <mtxinu!uunet.UU.NET!jmm%eci386@Sun.COM>
+        mp was no longer correctly recognising "from " header lines. This was
+        a bug in hdr_equal(), and affected the default mode of mail printing.
+        I've used a replacement hdr_equal() routine from Amos, which only
+        scans the string once instead of four times.
+ 
+     *  From Mike Khaw <khaw@parcplace.com>
+        From yonkers@ncsc.org
+        In our environment the "newfile" code causes the Apple laserwriter NTX's
+        to barf. This is a page reversal problem, with the PostScript routine
+        newfile being undefined. All references to newfile and endfile have
+        been removed from the prologue files and the mp program. The routine
+        startfile() has been left in as a null routine for now.
+ 
+     *  From Ian Hoyle <ianh@bhpmrl.oz.au>
+        There is a problem with allocation of memory via the realloc calls in
+        print.c, on an SGI box running Irix 3.2, due to rounding. I'm simply
+        allocated one extra byte in each of the realloc calls.
+ 
+     *  From John Macdonald <mtxinu!uunet.UU.NET!jmm%eci386@Sun.COM>
+        Now that mp is case insensitive about mail headers, it was possible for
+        mail digests (ala comp.risks) and mail folders to be incorrectly
+        processed. If mp was finding a line beginning with "from ", it was
+        taking this as the start of a new message. A check has been added to
+        the folder and digest processing in printfile() in main.c, to only
+        proceed with new message processing, if the line in question matches
+        the test criteria *and* the first character is upper-case.
+ 
+     *  From Francois Ougier <ougier@saphir.cl.bull.fr>
+        Just like pageno, colct should be reset (to 0) when looping for
+        argument files in main.c (line 164). Otherwise, when printing multiple
+        ascii files in landscape mode, the second column of each first page is
+        always empty..
+ 
+     *  From Francois Ougier <ougier@saphir.cl.bull.fr>
+        The README file has been changed to suggest that a page length of 70
+        might be more useful to A4 sites, rather than 72, and to include that
+        86 seems a good value for LineLength in landscape mode for A4 paper.

------- mp.pro.ts.ps -------
*** /tmp/da02815	Thu Nov  1 15:25:21 1990
--- mp.pro.ts.ps	Thu Nov  1 13:52:14 1990
***************
*** 89,104 ****
    grestore
  } def
  
- /newfile
- {
-   /FileSave save def    % file-level save...
- } def
- 
- /endfile
- {
-   FileSave restore      % ...and restore
- } def
- 
  /endcol			% page_number column_number endcol --
  {
    /thiscol exch def	% column_number
--- 89,94 ----

------- TODO -------
*** /tmp/da02819	Thu Nov  1 15:25:22 1990
--- TODO	Thu Nov  1 14:54:08 1990
***************
*** 103,105 ****
--- 103,114 ----
      The chunk in the Makefile that makes links has a variant of 'echo' that
      doesn't work on SysV-like systems.  'echo -n "foobar"' looks like
      'echo "foobar\c" on SysV.
+ 
+ 17/ From Felix Ingrand <felix@ai.sri.com>
+     By default, it seems more appropriate to use PAGELENGTH 69 on US paper.
+     It is not enought to change PAGELENGTH in mp.h, but you have to change
+     it in the ps prolog too...
+ 
+ 18/ The ability to be able to change the number of "words" extracted from
+     the user's gecos field, and the maximum number of characters extracted,
+     via a command line option, for those sites which don't have source to mp.

------- mp.pro.alt.ps -------
*** /tmp/da02822	Thu Nov  1 15:25:23 1990
--- mp.pro.alt.ps	Thu Nov  1 13:51:39 1990
***************
*** 90,105 ****
    showpage		% display it
  } def
  
- /newfile
- {
-   /FileSave save def    % file-level save...
- } def
-  
- /endfile
- {
-   FileSave restore      % ...and restore
- } def
- 
  /endcol			% page_number col_number endcol --
  {
    pop			% get rid of col_number
--- 90,95 ----

------- mp.pro.l.ps -------
*** /tmp/da02825	Thu Nov  1 15:25:24 1990
--- mp.pro.l.ps	Thu Nov  1 13:51:57 1990
***************
*** 91,106 ****
    showpage              % display it
  } def
  
- /newfile
- {
-   /FileSave save def    % file-level save...
- } def
- 
- /endfile
- {
-   FileSave restore      % ...and restore
- } def
- 
  /endcol			% page_number col_number endcol --
  {
    pop			% get rid of column number
--- 91,96 ----