[comp.sources.bugs] Official patch #1 to faces v1.3.

richb@sunchat.oz (Rich Burridge) (12/28/88)

This is official patch #1 for faces v1.3; please apply it.

It fixes the following problems:

1/ The SunView version of faces incorrectly compiled under SunOS
   v3.5. Thanks to Mike Khaw for finding and fixing this.
2/ SunView faces core dumped when not run natively.
3/ If a user's face directory contained both a face.ps and another
   type of icon, then the other type of icon would not be found
   with the SunView version.
4/ Blank lines in the machine.tab and people.tab caused core dumps.
   Thanks to Tony Kusalik for pointing this out.

Feed this file to Larry Walls' 'patch' program to apply this patch,
then recompile.

    Rich.

------CUT HERE------CUT HERE------
*** original/faces.h	Sun Dec 11 15:05:47 1988
--- faces.h	Wed Dec 28 15:35:49 1988
***************
*** 1,5 ****
  
! /*  @(#)faces.h 1.3 88/12/09
   *
   *  Contains all the global definitions used by faces.
   *
--- 1,5 ----
  
! /*  @(#)faces.h 1.4 88/12/28
   *
   *  Contains all the global definitions used by faces.
   *
***************
*** 57,63 ****
  enum mon_type { MONALL, MONNEW, MONPRINTER } ;
  
  /* Different graphics systems appropriate one set in gtype. */
! enum gr_type { SUNVIEW, NEWS } ;
  
  /* Determine order for face type lookup. */
  #define  NEWSTYPE        0
--- 57,63 ----
  enum mon_type { MONALL, MONNEW, MONPRINTER } ;
  
  /* Different graphics systems appropriate one set in gtype. */
! enum gr_type { SVIEW, NEWS } ;
  
  /* Determine order for face type lookup. */
  #define  NEWSTYPE        0
*** original/main.c	Sun Dec 11 15:05:48 1988
--- main.c	Wed Dec 28 15:35:47 1988
***************
*** 1,5 ****
  #ifndef lint
! static char sccsid[] = "@(#)main.c 1.2 88/12/11" ;
  #endif
  
  /*  Icon face server for monitoring mail and print jobs.
--- 1,5 ----
  #ifndef lint
! static char sccsid[] = "@(#)main.c 1.3 88/12/28" ;
  #endif
  
  /*  Icon face server for monitoring mail and print jobs.
***************
*** 229,235 ****
    for (i = 0; i < MAXTYPES; i++)
      {
        SPRINTF(iconname, "%s/%s/%s/%s", facedir, community, user, fname[i]) ;
!       if (stat(iconname, &buf) != -1) return ;
      }
   
    for (i = 0; i < MAXTYPES; i++)
--- 229,239 ----
    for (i = 0; i < MAXTYPES; i++)
      {
        SPRINTF(iconname, "%s/%s/%s/%s", facedir, community, user, fname[i]) ;
!       if (stat(iconname, &buf) != -1)
!         {
!           if (EQUAL(fname[i],"face.ps") && gtype != NEWS) continue ;
!           else return ;
!         }
      }
   
    for (i = 0; i < MAXTYPES; i++)
***************
*** 237,244 ****
        SPRINTF(iconname, "%s/misc./%s/%s", facedir, user, fname[i]) ;
        if (stat(iconname, &buf) != -1)
          {
!           STRCPY(community, "misc.") ;
!           return ;
          }
      }
   
--- 241,252 ----
        SPRINTF(iconname, "%s/misc./%s/%s", facedir, user, fname[i]) ;
        if (stat(iconname, &buf) != -1)
          {
!           if (EQUAL(fname[i], "face.ps") && gtype != NEWS) continue ;
!           else
!             {
!               STRCPY(community, "misc.") ;
!               return ;
!             }
          }
      }
   
***************
*** 247,254 ****
        SPRINTF(iconname, "%s/%s/unknown/%s", facedir, community, fname[i]) ;
        if (stat(iconname, &buf) != -1)
          {
!           STRCPY(user, "unknown") ;
!           return ;
          }
      }
  
--- 255,266 ----
        SPRINTF(iconname, "%s/%s/unknown/%s", facedir, community, fname[i]) ;
        if (stat(iconname, &buf) != -1)
          {
!           if (EQUAL(fname[i], "face.ps") && gtype != NEWS) continue ;
!           else
!             {
!               STRCPY(user, "unknown") ;
!               return ;
!             }
          }
      }
  
***************
*** 257,265 ****
        SPRINTF(iconname, "%s/misc./unknown/%s", facedir, fname[i]) ;
        if (stat(iconname, &buf) != -1)
          {
!           STRCPY(community, "misc.") ;
!           STRCPY(user, "unknown") ;
!           return ;
          }
      }
  
--- 269,281 ----
        SPRINTF(iconname, "%s/misc./unknown/%s", facedir, fname[i]) ;
        if (stat(iconname, &buf) != -1)
          {
!           if (EQUAL(fname[i], "face.ps") && gtype != NEWS) continue ;
!           else
!             {
!               STRCPY(community, "misc.") ;
!               STRCPY(user, "unknown") ;
!               return ;
!             }
          }
      }
  
*** original/patchlevel.h	Sun Dec 11 15:06:15 1988
--- patchlevel.h	Wed Dec 28 15:35:50 1988
***************
*** 1,5 ****
   
! /*  @(#)patchlevel.h 1.1 88/12/04
   *
   *  This is the current patch level for this version of faces.
   *
--- 1,5 ----
   
! /*  @(#)patchlevel.h 1.2 88/12/28
   *
   *  This is the current patch level for this version of faces.
   *
***************
*** 14,17 ****
   *  reported to me then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  0
--- 14,17 ----
   *  reported to me then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  1
*** original/rec.c	Sun Dec 11 15:06:28 1988
--- rec.c	Wed Dec 28 15:35:48 1988
***************
*** 1,6 ****
  /*LINTLIBRARY*/
  #ifndef lint
! static char sccsid[] = "@(#)rec.c 1.2 88/12/09" ;
  #endif
  
  /*  Record handling routines used by the faces program.
--- 1,6 ----
  /*LINTLIBRARY*/
  #ifndef lint
! static char sccsid[] = "@(#)rec.c 1.3 88/12/28" ;
  #endif
  
  /*  Record handling routines used by the faces program.
***************
*** 175,185 ****
--- 175,188 ----
    while (fgets(nextline, MAXLINE, fd) != NULL)
      {
        ptr1 = index(nextline, '/') ;
+       if (((int) (ptr1-nextline)) <= 0) continue ;  /* Ignore if no length. */
        STRNCPY(hostname, nextline, (int) (ptr1-nextline)) ;
        hostname[(int) (ptr1-nextline)] = '\0' ;
        ptr2 = index(nextline, '=') ;
+       if (((int) (ptr2-ptr1-1)) <= 0) continue ;    /* Ignore if no length. */
        STRNCPY(alias, ptr1+1, (int) (ptr2-ptr1-1)) ;
        alias[(int) (ptr2-ptr1-1)] = '\0' ;
+       if ((strlen(ptr2)-2) <= 0) continue ;         /* Ignore if no length. */
        STRNCPY(username, ptr2+1, strlen(ptr2)-2) ;
        username[strlen(ptr2)-2] = '\0' ;
        check_comm(hostname, username, alias) ;
***************
*** 203,210 ****
--- 206,215 ----
    while (fgets(nextline, MAXLINE, fd) != NULL)
      {
        ptr = index(nextline, '=') ;
+       if (((int) (ptr-nextline)) <= 0) continue ;  /* Ignore if no length. */
        STRNCPY(machine, nextline, (int) (ptr-nextline)) ;
        machine[(int) (ptr-nextline)] = '\0' ;
+       if (strlen(ptr)-2 <= 0) continue ;           /* Ignore if no length. */
        STRNCPY(community, ptr+1, strlen(ptr)-2) ;
        community[strlen(ptr)-2] = '\0' ;
        add_machine(machine, community) ;
*** original/sunview.c	Sun Dec 11 15:06:28 1988
--- sunview.c	Wed Dec 28 15:35:49 1988
***************
*** 1,6 ****
  /*LINTLIBRARY*/
  #ifndef lint
! static char sccsid[] = "@(#)sunview.c 1.1 88/12/04" ;
  #endif
  
  /*  SunView dependent graphics routines used by faces,
--- 1,6 ----
  /*LINTLIBRARY*/
  #ifndef lint
! static char sccsid[] = "@(#)sunview.c 1.2 88/12/28" ;
  #endif
  
  /*  SunView dependent graphics routines used by faces,
***************
*** 188,194 ****
  
  init_ws_type()
  {
!   gtype = SUNVIEW ;
    return 0 ;
  }
  
--- 188,201 ----
  
  init_ws_type()
  {
!   char *getenv() ;
! 
!   if (getenv("WINDOW_PARENT") == NULL)
!     {
!       FPRINTF(stderr,"%s: Not a native SunView window\n", progname) ;
!       return -1 ;
!     }
!   gtype = SVIEW ;
    return 0 ;
  }