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

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

This is official patch #4 for faces v1.1, please apply it.
 
It makes the following two changes:

1. When monitoring a printer, faces now checks for no paper in
   the printer, and displays an appropriate icon. Thanks to
   Adrian Cockcroft <camcon!anc@munnari.oz> for this change.

2. The procedure that parses the command line options, has been
   rewritten to use getopts. Thanks to Ian Darwin <sun!sq.sq.com!ian>
   for this change.

Use Larry Walls' patch program to apply these changes.

Note that several suggestions for faces have been reported to me.
Also faces core dumps in at least one situation, and it still leaks
memory bad. With real work permitting, I will endevour to fix these
problems, and implement the suggestions as soon as possible.

    Rich.

------CUT HERE------CUT HERE------
*** original/faces.h	Thu Jul 14 11:54:38 1988
--- faces.h	Mon Aug  1 09:11:21 1988
***************
*** 43,49 ****
  enum field_type { HOSTNAME, TIMESTAMP, USERNAME } ;
  
  /* Different types of possible face images. */
! enum icon_type { MAILERD, NOFACE, NOMAIL, NOPRINT, ORDINARY } ;
  
  /* Text justification within face display. */
  enum just_type { TOPLEFT, TOPRIGHT, BOTTOMLEFT, BOTTOMRIGHT } ;
--- 43,49 ----
  enum field_type { HOSTNAME, TIMESTAMP, USERNAME } ;
  
  /* Different types of possible face images. */
! enum icon_type { MAILERD, NOFACE, NOMAIL, NOPAPER, NOPRINT, ORDINARY } ;
  
  /* Text justification within face display. */
  enum just_type { TOPLEFT, TOPRIGHT, BOTTOMLEFT, BOTTOMRIGHT } ;
*** original/get.c	Thu Jul 14 11:54:18 1988
--- get.c	Thu Aug  4 11:55:55 1988
***************
*** 73,116 ****
  int argc ;
  char *argv[] ;
  {
!   INC ;
!   while (argc > 0)
!     {
!       if (argv[0][0] == '-')
!         switch (argv[0][1])
!           {
!             case 'P' : INC ;         /* Monitor printer queue. */
!                        mtype = MONPRINTER ;
!                        if (*argv != NULL && argv[0][0] != '-')
!                          STRCPY(printer,*argv) ;
!                        else DEC ;
!                        break ;
!             case 'a' : mtype = MONALL ;    /* Monitor the whole of the spoolfile. */
!                        break ;
!             case 'f' : INC ;         /* Different directory for face icons. */
!                        STRCPY(facedir,*argv) ;
!                        break ;
!             case 'h' : INC ;         /* Default hostname for mail with no hostname. */
!                        STRCPY(defhost,*argv) ;
!                        break ;
!             case 'i' : INC ;         /* Set interval for checking (in seconds). */
!                        interval = atoi(*argv) ;
!                        break ;
!             case 'n' : dontshowno = 1 ;  /* Do not show number of messages. */
!                        break ;
!             case 's' : INC ;         /* Alternative spoolfile to monitor. */
!                        STRCPY(spoolfile,*argv) ;
!                        break ;
!             case 't' : dontshowtime = 1 ;  /* Do not show timestamps. */
!                        break ;
!             case 'v' : FPRINTF(stderr,"%s version 1.0.%1d\n",progname,PATCHLEVEL) ;
!                        exit(1) ;
!             case '?' : FPRINTF(stderr,"Usage: %s [-P printer] [-f facedir] [-h defhost] ") ;
!                        FPRINTF(stderr,"[-i] [-n] [-s spoolfile] [-t] [-v] [-?]\n",progname) ;
!                        exit(1) ;
!           }
!       INC ;
!     }
  }
  
  
--- 73,109 ----
  int argc ;
  char *argv[] ;
  {
!   extern int optind ;
!   extern char *optarg ;
!   int c ;
!   char *optlist = "P:af:h:i:ns:tv" ;
! 
!   while ((c = getopt(argc, argv, optlist)) != EOF)
!     switch (c)
!       {
!         case 'P' : mtype = MONPRINTER ;       /* Monitor printer queue. */
!                    STRCPY(printer, optarg) ;
!                    break ;
!         case 'a' : mtype = MONALL ;           /* Monitor the whole of the spoolfile. */
!                    break ;
!         case 'f' : STRCPY(facedir, optarg) ;  /* Different directory for face icons. */
!                    break ;
!         case 'h' : STRCPY(defhost, optarg) ;  /* Default hostname for mail with no hostname. */
!                    break ;
!         case 'i' : interval = atoi(optarg) ;  /* Set interval for checking (in seconds). */
!                    break ;
!         case 'n' : dontshowno = 1 ;           /* Do not show number of messages. */
!                    break ;
!         case 's' : STRCPY(spoolfile, optarg) ;  /* Alternative spoolfile to monitor. */
!                    break ;
!         case 't' : dontshowtime = 1 ;         /* Do not show timestamps. */
!                    break ;
!         case 'v' : FPRINTF(stderr, "%s version 1.0.%1d\n", progname, PATCHLEVEL) ;
!                    exit(1) ;
!         default  : FPRINTF(stderr, "Usage: %s [-P printer] [-f facedir] [-h defhost] ", progname) ;
!                    FPRINTF(stderr, "[-i interval] [-n] [-s spoolfile] [-t] [-v] [-?]\n") ;
!                    exit(1) ;
!       }
  }
  
  
*** original/mon.c	Mon Jul 18 16:25:13 1988
--- mon.c	Mon Aug  1 13:09:57 1988
***************
*** 161,166 ****
--- 161,172 ----
        add_face(BOTH, NOPRINT, "") ;      /* Set to "no print" icon. */
        text(BOTH, TOPLEFT, printer) ;     /* Output printer name. */
      }
+   else if (EQUAL(nextline,"Printer Error: may need attention!"))
+     {
+       make_pixrect(1) ;                  /* Just the "no paper" icon. */
+       add_face(BOTH, NOPAPER, "") ;      /* Set to "no paper" icon. */
+       text(BOTH, TOPLEFT, printer) ;     /* Output printer name. */
+     }
    else
      {
        FGETS(nextline,MAXLINE,fp) ;    /* Skip the next line. */
*** original/nopaper.icon	Thu Aug  4 11:59:42 1988
--- nopaper.icon	Mon Aug  1 09:02:39 1988
***************
*** 0 ****
--- 1,34 ----
+ /* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
+  */                                        
+ 	0xC000,0x0000,0x0000,0x0003,0xE000,0x0000,0x0000,0x0007,
+ 	0x7000,0x0000,0x0000,0x000E,0x3800,0x0000,0x0000,0x001C,
+ 	0x1C00,0x0000,0x0000,0x0038,0x0E00,0x0000,0x0000,0x0070,
+ 	0x0700,0x0000,0x0000,0x00E0,0x0380,0x0000,0x0000,0x01C0,
+ 	0x01C0,0x0000,0x0000,0x0380,0x00E0,0x0000,0x0000,0x0700,
+ 	0x0070,0x0000,0x0000,0x0E00,0x0038,0x0000,0x0000,0x1C00,
+ 	0x001C,0x0000,0x0000,0x3800,0x000E,0x0000,0x0000,0x7000,
+ 	0x0007,0x0000,0x0000,0xE000,0x0003,0x8000,0x0001,0xC000,
+ 	0x0001,0xC000,0x0003,0x8000,0x0000,0xE000,0x0007,0x0000,
+ 	0x0000,0x7000,0x000E,0x0000,0x0000,0x7FFF,0xFFFF,0xC000,
+ 	0x0000,0xBC00,0x0038,0x2000,0x0001,0x1E00,0x0070,0x1000,
+ 	0x0002,0x0F00,0x00E0,0x0800,0x0004,0x0780,0x01C0,0x0400,
+ 	0x0004,0x05C0,0x0380,0x0400,0x0008,0x42E0,0x0700,0x0200,
+ 	0x0008,0xE270,0x0E00,0x0200,0x0009,0xF238,0x1C00,0x0200,
+ 	0x0009,0xF21C,0x3800,0x0200,0x0009,0xF20E,0x7000,0x0200,
+ 	0x0009,0xF207,0xE000,0x0200,0x0009,0xF203,0xC000,0x0200,
+ 	0x0008,0xE203,0xC000,0x0200,0x0008,0x4207,0xE000,0x0200,
+ 	0x0004,0x040E,0x7000,0x0400,0x0004,0x041C,0x3800,0x0400,
+ 	0x0006,0x0838,0x1C00,0x0800,0x0007,0x1070,0x0E00,0x1000,
+ 	0x0002,0xA0E0,0x0700,0x2000,0x0002,0x7FFF,0xFFFF,0xC000,
+ 	0x0002,0x0380,0x01C2,0x0000,0x0002,0x0700,0x00E1,0x0000,
+ 	0x0003,0x0E00,0x0071,0x0000,0x0001,0x1C00,0x0039,0x0000,
+ 	0x0001,0x3800,0x001C,0x8000,0x0000,0xF000,0x000E,0x8000,
+ 	0x0000,0xE000,0x0007,0x8000,0x0001,0xC000,0x0003,0x8000,
+ 	0x0003,0x8000,0x0001,0xC000,0x0007,0x8000,0x0000,0xE000,
+ 	0x000E,0x4030,0x0000,0x7000,0x001C,0x41FC,0x0000,0x7800,
+ 	0x0038,0x4F02,0x003C,0x5C00,0x0070,0x5401,0xC1C2,0x2E00,
+ 	0x00E0,0x6000,0x3F01,0xC700,0x01C0,0x0000,0x0000,0x0380,
+ 	0x0380,0x0000,0x0000,0x01C0,0x0700,0x0000,0x0000,0x00E0,
+ 	0x0E00,0x0000,0x0000,0x0070,0x1C00,0x0000,0x0000,0x0038,
+ 	0x3800,0x0000,0x0000,0x001C,0x7000,0x0000,0x0000,0x000E,
+ 	0xE000,0x0000,0x0000,0x0007,0xC000,0x0000,0x0000,0x0003
*** original/patchlevel.h	Mon Jul 18 16:25:13 1988
--- patchlevel.h	Thu Aug  4 11:51:58 1988
***************
*** 16,19 ****
   *  reported to me then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  3
--- 16,19 ----
   *  reported to me then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  4
*** original/sunview.c	Thu Jul 14 11:54:38 1988
--- sunview.c	Mon Aug  1 09:08:58 1988
***************
*** 68,73 ****
--- 68,78 ----
  } ;
  mpr_static(nomail_pr,64,64,1,nomail_image) ;
  
+ short nopaper_image[] = {
+ #include "nopaper.icon"
+ } ;
+ mpr_static(nopaper_pr,64,64,1,nopaper_image) ;
+ 
  short noprint_image[] = {
  #include "noprint.icon"
  } ;
***************
*** 89,94 ****
--- 94,101 ----
        case NOFACE   : face_pr = &noface_pr ;
                        break ;
        case NOMAIL   : face_pr = &nomail_pr ;
+                       break ;
+       case NOPAPER  : face_pr = &nopaper_pr ;
                        break ;
        case NOPRINT  : face_pr = &noprint_pr ;
                        break ;