[comp.sources.misc] v14i090: Official patch #6 for mp v2.4; please apply it.

rburridge@Sun.COM (Rich Burridge) (09/16/90)

Posting-number: Volume 14, Issue 90
Submitted-by: rburridge@Sun.COM (Rich Burridge)
Archive-name: mp-2.4.5/patch01

[Brandon, could you post this to comp.sources.misc please? I've already
 posted a copy to comp.sources.bugs. Thanks].

Mp is a Postscript pretty printer for mail,news and ordinary files.

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

** Mp v2.4 was posted to comp.sources.misc last week at patchlevel #5. **

It makes the following changes:

    *  From Amos Shapir <amos@taux01.nsc.com>
       Interpreting a '&' in the GECOS field should capitalize only the
       first letter of the login name, not all of it.

    *  From Bruce G Barnett <barnett@unclejack.crd.ge.com>
       From Pauline van Winsen <pauline@Aus.Sun.COM>
       Mp only extracted two "words" from the user's passwd gecos field.
       This has been changed to now extract three "words" by default, but
       two new definitions have been added to the Makefile.dist file to
       allow you to adjust the username extraction:

       GECOSFIELDS - Number of "words" extracted from the user's gecos field.
       GECOSLENGTH - Maximum no. of chars. extracted from the gecos field.

       See the comments in the Makefile.dist file for more details.
       If needed, then these options should be uncommented and set accordingly.
       The README file has been updated.

    *  From Johan Vromans <jv@mh.nl>
       An attempt to initialise the cc array in main.c when the variable
       is declared doesn't work with the GNU C compiler. This has been
       removed. Yes folks, this is deja vu.

    *  From Johan Vromans <jv@mh.nl>
       To allow MP to handle A4 formatted pages, I made a few mods to
       mp.pro.ps. The reason to introduce the variables fullwidth and
       fullheight is that they are used in more than one location.
       Reasonable values for fullwidth and fullheight are 8.5/11 inch for US
       Letter, and 8.5/11.4 inch for A4.
       Since sites usually have one single format of paper, mp could be
       installed with either the USLetter or A4 values.

       I've also made the same modifications to mp.pro.alt.ps.

       **IMPORTANT NOTE** You should adjust these values correctly for your
                          site. I've added a couple of comments to the
                          "make install" to try to remind people about this.

       I've also left it defaulted at the US Letter size, so it should still
       continue to work for A4 sites, but not use all of the paper.

TO INSTALL:
-----------

Apply this patch with Larry Wall's patch program. Copy Makefile.dist to
Makefile and adjust for your site. Then do a "make". Check the paper size
in mp.pro.ps is correct for your site (US Letter or A4), then do a "make
install".

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

------- README -------
*** /tmp/da00708	Tue Sep  4 11:43:02 1990
--- README	Tue Sep  4 11:01:17 1990
***************
*** 47,54 ****
  
  These are:
  
! PROLOGUE - Location of the mp prologue file (default: /usr/local/lib)
! NOINDEX  - uncomment if you don't have the index() function.
  
  See the Makefile for a detailed description of each of these definitions.
  
--- 47,56 ----
  
  These are:
  
! GECOSFIELDS - Number of "words" extracted from the user's gecos field.
! GECOSLENGTH - Maximum number of characters extracted from the gecos field.
! NOINDEX     - uncomment if you don't have the index() function.
! PROLOGUE    - Location of the mp prologue file (default: /usr/local/lib)
  
  See the Makefile for a detailed description of each of these definitions.
  
***************
*** 81,88 ****
  Avolio, Mark Prior, Stephen Frede, Craig Bishop, Jimmy Aitken, Hugues Leroy,
  Bertrand Decouty, David Fiedler, Scott A. Jordahl, David Boone, Steve Cliffe,
  Maureen Chew, Brian Kohn, Walter Underwood, Mike Khaw, Rick Gunderson, Johan
! Vromans, Brachet, Pierre Mareschal, Roger Riggs, Larry Tsui and Mike
! Bundschuh 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
--- 83,91 ----
  Avolio, Mark Prior, Stephen Frede, Craig Bishop, Jimmy Aitken, Hugues Leroy,
  Bertrand Decouty, David Fiedler, Scott A. Jordahl, David Boone, Steve Cliffe,
  Maureen Chew, Brian Kohn, Walter Underwood, Mike Khaw, Rick Gunderson, Johan
! Vromans, Brachet, Pierre Mareschal, Roger Riggs, Larry Tsui, Mike Bundschuh,
! Amos Shapir, Bruce G Barnett and Pauline van Winsen 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/da00711	Tue Sep  4 11:43:03 1990
--- mp.pro.ps	Tue Sep  4 11:41:20 1990
***************
*** 10,19 ****
  %%EndComments
  
  /inch { 72 mul } def
  /leftedge 0 def
! /rightedge 8.5 inch def
  /bottomedge 0 def
! /topedge 11 inch def
  /LandscapeMode false def
  
  %Title: backspacefont.ps suggested by Glenn Reid (Adobe Systems).
--- 10,29 ----
  %%EndComments
  
  /inch { 72 mul } def
+ %
+ %  IMPORTANT NOTE: The following two variables should be set correctly.
+ %                  Reasonable values for fullwidth and fullheight are
+ %                  8.5/11 inch for US Letter, and 8.5/11.4 inch for A4.
+ %                  Since sites usually have one single format of paper,
+ %                  mp should be installed with either the USLetter or A4
+ %                  values.
+ %
+ /fullwidth 8.5 inch def
+ /fullheight 11 inch def
  /leftedge 0 def
! /rightedge fullwidth def
  /bottomedge 0 def
! /topedge fullheight def
  /LandscapeMode false def
  
  %Title: backspacefont.ps suggested by Glenn Reid (Adobe Systems).
***************
*** 129,136 ****
  /Landscape
  {
    /LandscapeMode true def
!   /rightedge 11 inch def
!   /topedge 8.5 inch def
    newpage
  } def
  
--- 139,146 ----
  /Landscape
  {
    /LandscapeMode true def
!   /rightedge fullheight def
!   /topedge fullwidth def
    newpage
  } def
  

------- main.c -------
*** /tmp/da00714	Tue Sep  4 11:43:03 1990
--- main.c	Tue Sep  4 11:04:16 1990
***************
*** 74,80 ****
  char *apparently_from = NULL ;    /* Apparently_from: */
  char *to[MAXCONT+1] ;             /* To: (can have multiple lines) */
  char *apparently_to   = NULL ;    /* Apparently_to: */
! char *cc[MAXCONT+1]   = NULL ;    /* Cc: (can have multiple lines) */
  char *subject         = NULL ;    /* Subject: (can be set from command line) */
  char *gsubject        = NULL ;    /* Global subject set from command line. */
  char *date            = NULL ;    /* Date: */
--- 74,80 ----
  char *apparently_from = NULL ;    /* Apparently_from: */
  char *to[MAXCONT+1] ;             /* To: (can have multiple lines) */
  char *apparently_to   = NULL ;    /* Apparently_to: */
! char *cc[MAXCONT+1] ;             /* Cc: (can have multiple lines) */
  char *subject         = NULL ;    /* Subject: (can be set from command line) */
  char *gsubject        = NULL ;    /* Global subject set from command line. */
  char *date            = NULL ;    /* Date: */

------- misc.c -------
*** /tmp/da00717	Tue Sep  4 11:43:04 1990
--- misc.c	Tue Sep  4 10:50:46 1990
***************
*** 126,133 ****
--- 126,147 ----
    char *c, *ptr ;
    int amp_cnt = 0 ;     /* Number of ampersands in gecos field. */
    int i, j, n, spaces ;
+   int namefields ;      /* Number of "words" from passwd gecos. */
+   int namelength ;      /* Maximum number of characters from passwd gecos. */
    struct passwd *pp ;
  
+ #ifdef GECOSFIELDS
+   namefields = GECOSFIELDS ;  /* New no. of "words" from passwd gecos. */
+ #else
+   namefields = NAMEFIELDS ;   /* Not supplied; use default. */
+ #endif /*GECOSFIELDS*/
+ 
+ #ifdef GECOSLENGTH
+   namelength = GECOSLENGTH ;  /* New max. no. of chars. from passwd gecos. */
+ #else
+   namelength = NAMELENGTH ;   /* Not supplied; use default. */
+ #endif /*GECOSLENGTH*/
+ 
    c = getlogin() ;      /* Pointer to users login name. */
    if (c == NULL)        /* Get username from password file */
      {
***************
*** 141,147 ****
  /*  Have a look for the users gecos (normally real name), so that its a bit
   *  more recognisable. If this field is too long, then we need to truncate
   *  sensibly. We also need to check a few things. If we've extracted
!  *  two "words" or have found a comma, then exit. If an ampersand is
   *  found, this is expanded to the users name in capitals.
   */    
       
--- 155,161 ----
  /*  Have a look for the users gecos (normally real name), so that its a bit
   *  more recognisable. If this field is too long, then we need to truncate
   *  sensibly. We also need to check a few things. If we've extracted
!  *  three "words" or have found a comma, then exit. If an ampersand is
   *  found, this is expanded to the users name in capitals.
   */    
       
***************
*** 161,180 ****
                 if (*ptr == ',') break ;
            else if (*ptr == '&')
              {
!               for (j = 0; j < strlen(c); j++)
!                 if (islower(c[j])) owner[n++] = toupper(c[j]) ;
!                 else owner[n++] = c[j] ;
                *ptr++ ;
              }
            else if (*ptr == ' ')
              {
!               if (++spaces == 2) break ;
                else owner[n++] = *ptr++ ;
              }
            else owner[n++] = *ptr++ ;
!           if (n >= NAMELENGTH) break ;
          }
!       if (n > NAMELENGTH) n = NAMELENGTH ;
        owner[n] = '\0' ;
      }
    if ((nameptr = getenv("NAME")) != NULL)
--- 175,194 ----
                 if (*ptr == ',') break ;
            else if (*ptr == '&')
              {
!               if (islower(c[0])) owner[n++] = toupper(c[0]) ;   
!               for (j = 1; j < strlen(c); j++)                 
!                 owner[n++] = c[j] ;
                *ptr++ ;
              }
            else if (*ptr == ' ')
              {
!               if (++spaces == namefields) break ;
                else owner[n++] = *ptr++ ;
              }
            else owner[n++] = *ptr++ ;
!           if (n >= namelength) break ;
          }
!       if (n > namelength) n = namelength ;
        owner[n] = '\0' ;
      }
    if ((nameptr = getenv("NAME")) != NULL)

------- CHANGES -------
*** /tmp/da00720	Tue Sep  4 11:43:05 1990
--- CHANGES	Tue Sep  4 11:36:02 1990
***************
*** 126,131 ****
--- 126,133 ----
  
  v2.4 - patchlevel 5. - 29th August 1990.
  
+     *  Posted to comp.sources.misc.
+ 
      *  From Larry W. Virden <lwv27%cas.BITNET@CUNYVM.CUNY.Edu>
         Include a Makefile.dist with the mp distribution. This file will
         need to be copied to Makefile and adjusted accordingly, but it does
***************
*** 135,137 ****
--- 137,182 ----
      *  From Lupe Christoph <lupe@alanya.Germany.Sun.COM>
         mp.pro.filofax.ps and mp.pro.timeman.ps still contained definitions
         for PrimaryFont and SecondaryFont.
+ 
+ v2.4 - patchlevel 6. - 4th September 1990.
+ 
+     *  From Amos Shapir <amos@taux01.nsc.com>
+        Interpreting a '&' in the GECOS field should capitalize only the
+        first letter of the login name, not all of it.
+ 
+     *  From Bruce G Barnett <barnett@unclejack.crd.ge.com>
+        From Pauline van Winsen <pauline@Aus.Sun.COM>
+        Mp only extracted two "words" from the user's passwd gecos field.
+        This has been changed to now extract three "words" by default, but
+        two new definitions have been added to the Makefile.dist file to
+        allow you to adjust the username extraction:
+ 
+        GECOSFIELDS - Number of "words" extracted from the user's gecos field.
+        GECOSLENGTH - Maximum no. of chars. extracted from the gecos field.
+ 
+        See the comments in the Makefile.dist file for more details.
+        If needed, then these options should be uncommented and set accordingly.
+        The README file has been updated.
+ 
+     *  From Johan Vromans <jv@mh.nl>
+        An attempt to initialise the cc array in main.c when the variable
+        is declared doesn't work with the GNU C compiler. This has been
+        removed. Yes folks, this is deja vu.
+ 
+     *  From Johan Vromans <jv@mh.nl>
+        To allow MP to handle A4 formatted pages, I made a few mods to
+        mp.pro.ps. The reason to introduce the variables fullwidth and
+        fullheight is that they are used in more than one location.
+        Reasonable values for fullwidth and fullheight are 8.5/11 inch for US
+        Letter, and 8.5/11.4 inch for A4.
+        Since sites usually have one single format of paper, mp could be
+        installed with either the USLetter or A4 values.
+ 
+        I've also made the same modifications to mp.pro.alt.ps.
+ 
+        **IMPORTANT NOTE** You should adjust these values correctly for your
+                           site. I've added a couple of comments to the
+                           "make install" to try to remind people about this.
+ 
+        I've also left it defaulted at the US Letter size, so it should still
+        continue to work for A4 sites, but not use all of the paper.

------- patchlevel.h -------
*** /tmp/da00723	Tue Sep  4 11:43:05 1990
--- patchlevel.h	Tue Sep  4 09:47:47 1990
***************
*** 14,17 ****
   *  reported to me then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  5
--- 14,17 ----
   *  reported to me then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  6

------- mp.h -------
*** /tmp/da00726	Tue Sep  4 11:43:06 1990
--- mp.h	Tue Sep  4 10:20:27 1990
***************
*** 59,64 ****
--- 59,65 ----
  
  #define  MAXSIZES     4      /* Maximum number of different sizes. */
  
+ #define  NAMEFIELDS   3      /* Default no. of "words" from passwd gecos. */
  #define  NAMELENGTH   18     /* Maximum allowable real user name. */
  #define  PAGELENGTH   60     /* Number of lines per page. */
  #define  MAXCONT      10     /* Maximum no of continuation header lines */

------- Makefile.dist -------
*** /tmp/da00729	Tue Sep  4 11:43:06 1990
--- Makefile.dist	Tue Sep  4 11:34:29 1990
***************
*** 23,28 ****
--- 23,46 ----
  #
  #PROLOGUE = -DPROLOGUE=\"$(LIBDIR)\"
  #---------------------------------------------------------------------
+ #  Mp will extract the user's gecos field, and try to make sense of what
+ #  it finds. It applies various rules to do this. If this field is too long,
+ #  then it needs to truncate sensibly. If it's extracted N "words" or has
+ #  found a comma, then it stops extracting. If an ampersand is found, this
+ #  is expanded to the users name in capitals.
+ #  This option allows you to change the number of "words" that mp extracts
+ #  from the gecos field. By default this is 3. If needed, then it should
+ #  be uncommented, and set accordingly.
+ #
+ #GECOSFIELDS     = -DGECOSFIELDS=3
+ #---------------------------------------------------------------------
+ #  Mp will extract upto a certain number of characters from the user's
+ #  passwd gecos field. By default, this is 18. This option allows you to
+ #  set this to something different. If needed, then it should be uncommented,
+ #  and set accordingly.
+ #
+ #GECOSLENGTH     = -DGECOSLENGTH=18
+ #---------------------------------------------------------------------
  #  Not all machines have the index() string library function. If you
  #  don't have this function then you should uncomment the NOINDEX
  #  definition below.
***************
*** 40,46 ****
  #
  #  Compilation flags and standard macro definitions.
  #
! CFLAGS   = -g $(NOINDEX) $(PROLOGUE)
  LDFLAGS  =
  #=================================================================
  
--- 58,64 ----
  #
  #  Compilation flags and standard macro definitions.
  #
! CFLAGS   = -g $(GECOSFIELDS) $(GECOSLENGTH) $(NOINDEX) $(PROLOGUE)
  LDFLAGS  =
  #=================================================================
  
***************
*** 67,72 ****
--- 85,98 ----
  	   cc $(LDFLAGS) -o mp $(OBJS)
  
  install:   $(BINARIES)
+ 	   @echo
+ 	   @echo "**IMPORTANT NOTE**"
+ 	   @echo
+ 	   @echo "Mp is setup by default to work with US Letter sized paper."
+ 	   @echo "If you are using A4 sized paper, it is suggested that you"
+ 	   @echo "adjust the definitions of fullwidth and fullheight, at the"
+ 	   @echo "start of the mp.pro.ps file, then reinstall."
+ 	   @echo
  	   install -s -m 751 mp $(BINDIR)
  	   install -c -m 644 mp.1 $(MANDIR)/mp.$(MANSECT)
  	   install -c -m 644 mp.pro.ps $(LIBDIR)

------- TODO -------
*** /tmp/da00732	Tue Sep  4 11:43:07 1990
--- TODO	Tue Sep  4 11:40:09 1990
***************
*** 41,43 ****
--- 41,66 ----
     Better, a short program that takes a general mp.pro.organiser.ps and
     substitutes a few variables. Or you can use short PostScript fragments,
     one for each personal organisers.
+ 
+ 7/ From Lupe Christoph <lupe@alanya.Germany.Sun.COM>
+    The Time Manager and Filofax prologue files don't work correctly with
+    printers that are setup for page reversal. The solution (which I've
+    yet to implement), comes from Johan Vromans:
+ 
+    "The problem is caused by the fact that you insert a "%Page: ? nn"
+     before each *LOGICAL* page. It should be inserted only before *PHYSICAL*
+     pages.  For filofax and timemanager (3 cols/page) that means that you
+     need something like:
+ 
+         %% Preamble
+         %%Page: ? 1
+         ..page1..
+         endpage
+         ..page2..
+         endpage
+         ..page3..
+         endpage
+         %%Page: ? 2
+         ..page4..
+         endpage
+         ..."

------- mp.pro.alt.ps -------
*** /tmp/da00735	Tue Sep  4 11:43:07 1990
--- mp.pro.alt.ps	Tue Sep  4 11:41:33 1990
***************
*** 10,19 ****
  %%EndComments
  
  /inch { 72 mul } def
  /leftedge 0 def
! /rightedge 8.5 inch def
  /bottomedge 0 def
! /topedge 11 inch def
  /LandscapeMode false def
  
  %Title: backspacefont.ps suggested by Glenn Reid (Adobe Systems).
--- 10,29 ----
  %%EndComments
  
  /inch { 72 mul } def
+ %
+ %  IMPORTANT NOTE: The following two variables should be set correctly.
+ %                  Reasonable values for fullwidth and fullheight are
+ %                  8.5/11 inch for US Letter, and 8.5/11.4 inch for A4.
+ %                  Since sites usually have one single format of paper,
+ %                  mp should be installed with either the USLetter or A4
+ %                  values.
+ %
+ /fullwidth 8.5 inch def
+ /fullheight 11 inch def
  /leftedge 0 def
! /rightedge fullwidth def
  /bottomedge 0 def
! /topedge fullheight def
  /LandscapeMode false def
  
  %Title: backspacefont.ps suggested by Glenn Reid (Adobe Systems).
***************
*** 122,129 ****
  /Landscape
  {
    /LandscapeMode true def
!   /rightedge 11 inch def
!   /topedge 8.5 inch def
    newpage
  } def
  
--- 132,139 ----
  /Landscape
  {
    /LandscapeMode true def
!   /rightedge fullheight def
!   /topedge fullwidth def
    newpage
  } def