[comp.sources.bugs] Official patch #6 for faces v1.1.

richb@sunaus.oz (Rich Burridge) (08/10/88)

This is official patch #6 for faces v1.1, please apply it.
 
It makes the following alterations:

1. Fixes the incorrect fix in patch #5 for solving the memory
   leakage program. The call to pr_destroy should only be done
   if the icon was created with icon_load.

2. Check that the character strings in the recinfo records are
   not NULL pointers, before freeing them.

3. The faces manual page now has a description of how faces
   handles domain names, plus the wording on default hostname
   has been changed from sun to LOCAL. Thanks to Ian Darwin
   <sun!sq.sq.com!ian> for pointing these out.

4. Solves the core dump in do_mail at around line 80 reported
   by various people. The global record pointers 'recs' and
   'last' weren't being correct reset, if the record about to
   be removed by the remove_record routine, pointed to one or
   both of them.

Use Larry Walls' patch program to apply these changes.

I have also been given the following suggestions by various
people, which I hope to implement as time permits:

1. One thing that v8 vismon does is to have a "misc" directory
   for all the common system id's: root, uucp, MAILER-DAEMON, etc.

2. Also v8 has the notion of "unknown user" on a per-host
   basis, defaulting to "misc/unknown", so you can use
   a corporate logo as the unknown id for people from
   that site.

3. Mail headers are a strange and wonderous thing, rife with
   eldritch streams of punctuation that can be added by any
   sites along the way; they are frought with peril for the
   unwary.  In particular, some sites will throw in an at-sign
   when processing mail, so that instead of
     From local!foo!bar!who
   you will get
     From foo!bar!who@local
   A reasonable rule: if a host name has been found before the "!", throw
   away everything that does not precede the "@" in the user name.
   If none was found, use everything that follows the "@" as the
   host name.   What to do with "%" in the user name is left as an
   exercise for the reader.

4. On failing to find facelib/<host>/<user>, the program should,
   by convention, try facelib/ANYHOST/<user>,  then
   facelib/<host>/GENERIC, then finally facelib/ANYHOST/GENERIC
   (which would be the `unknown' ikon).   This would also allow
   a generalization of the treatment of "MAILER-DAEMON" to other
   common `users' such as "uucp", "root", "news", and the like
   (as well as allowing the fun of a library of, for example,
   corporate and university ikonic logos for mail originating at
   AT&T, Sun, UCLA...)

    Rich.

------CUT HERE------CUT HERE------CUT HERE------
*** original/faces.1	Wed Aug 10 16:32:50 1988
--- faces.1	Wed Aug 10 17:17:49 1988
***************
*** 80,85 ****
--- 80,94 ----
  is a special face directory, and the faces are stored by username in
  sub-directories which are by hostname.
  .LP
+ Domain name structure is achieved by multiple sub-directories. For
+ example, if the mail was from
+ .B user@stat.toronto.edu
+ then
+ .B faces
+ looks for the icon file in
+ .B /edu/toronto/stat/user
+ under the given faces directory.
+ .LP
  The closed and open window displays are just big enough for the number of
  faces to be displayed. The display will enlarge or contract as the mail spool
  folder size or the number of print jobs changes.
***************
*** 109,116 ****
  .TP
  .BI \-h " defhost"
  The default hostname to look under when mail arrives without a hostname.
! The default is
! .BR sun .
  .TP
  .BI \-i " interval"
  The interval period in seconds before the mail spool file is scanned again
--- 118,126 ----
  .TP
  .BI \-h " defhost"
  The default hostname to look under when mail arrives without a hostname.
! The default is a directory called
! .B LOCAL
! under the faces directory.
  .TP
  .BI \-i " interval"
  The interval period in seconds before the mail spool file is scanned again
*** original/patchlevel.h	Wed Aug 10 16:32:50 1988
--- patchlevel.h	Wed Aug 10 16:50:27 1988
***************
*** 16,19 ****
   *  reported to me then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  5
--- 16,19 ----
   *  reported to me then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  6
*** original/rec.c	Wed Aug 10 16:32:58 1988
--- rec.c	Wed Aug 10 18:56:58 1988
***************
*** 80,87 ****
  struct recinfo *lastrec, *thisrec ;
  {
    lastrec->next = thisrec->next ;
!   free(thisrec->hostname) ;
!   free(thisrec->username) ;
!   free(thisrec->iconname) ;
    free((char *) thisrec) ;
  }
--- 80,92 ----
  struct recinfo *lastrec, *thisrec ;
  {
    lastrec->next = thisrec->next ;
!   if (thisrec == recs) recs = thisrec->next ;
!   if (thisrec == last)
!     if (thisrec == lastrec) last = NULL ;
!     else last = lastrec ;
! 
!   if (thisrec->hostname != NULL) free(thisrec->hostname) ;
!   if (thisrec->username != NULL) free(thisrec->username) ;
!   if (thisrec->iconname != NULL) free(thisrec->iconname) ;
    free((char *) thisrec) ;
  }
*** original/sunview.c	Wed Aug 10 16:32:43 1988
--- sunview.c	Wed Aug 10 17:49:43 1988
***************
*** 86,92 ****
--- 86,94 ----
  {
    char error_msg[256] ;      /* Possible error message from icon_load_mpr. */
    Pixrect *face_pr ;
+   int freeit ;               /* Set if we should destroy this pixrect. */
  
+   freeit = 0 ;
    switch ((int) itype)
      {
        case MAILERD  : face_pr = &bounced_pr ;
***************
*** 105,110 ****
--- 107,113 ----
                                           progname,filename) ;
                            face_pr = &noface_pr ;
                          }
+                       else freeit = 1 ;
                        break ;
      }
    switch ((int) display)
***************
*** 127,133 ****
                                                    PIX_SRC, face_pr, 0, 0) ;
                         }
      }
!   PR_DESTROY(face_pr) ;
  }
  
  
--- 130,136 ----
                                                    PIX_SRC, face_pr, 0, 0) ;
                         }
      }
!   if (freeit) PR_DESTROY(face_pr) ;
  }