[comp.sources.bugs] Official patch #8 for faces v1.3; please apply it.

richb@sunchat.oz (Rich Burridge) (02/20/89)

This patch contains the changes needed to implement an MGR version of
faces. See the README and manual page for more details.

Note that there are a few slight differences with the MGR version over
the versions for the other graphics systems:

1/ The middle button is used with the default option, for clearing
   the open window display.

2/ The right mouse button is used to swap between the open and iconic
   displays.

If there are any MGR programmers reading this, perhaps somebody can
tell me how to turn off the character cursor when the faces window is
activated.

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

    Rich.

------CUT HERE------CUT HERE------
*** original/Makefile	Sun Feb  5 22:11:45 1989
--- Makefile	Sat Feb 18 21:59:42 1989
***************
*** 1,7 ****
  #
  #  Makefile for faces, an icon face server, plus associated software.
  #
! #  @(#)Makefile 1.6 89/02/05
  #
  #  Copyright (c) Rich Burridge.
  #                Sun Microsystems, Australia - All rights reserved.
--- 1,7 ----
  #
  #  Makefile for faces, an icon face server, plus associated software.
  #
! #  @(#)Makefile 1.7 89/02/18
  #
  #  Copyright (c) Rich Burridge.
  #                Sun Microsystems, Australia - All rights reserved.
***************
*** 87,98 ****
  #  then the following definition should be uncommented.
  #
  #ROADRUNNER     = -DSUN386i
  #-------------------------------------------------------------------
  
  VARIABLES       = $(FMONTYPE) $(BACKGROUND) $(FACEPARAM) \
                    $(INVERT) $(PERIOD) $(DONTSHOWNO) $(SPOOLFILE) \
  		  $(DONTSHOWTIME) $(DONTSHOWUSER)
! BINARIES        = ps_faces sv_faces x11_faces
  BINDIR          = /usr/local/bin
  FACES           = facedir
  LIBDIR          = /usr/local/lib
--- 87,105 ----
  #  then the following definition should be uncommented.
  #
  #ROADRUNNER     = -DSUN386i
+ #
+ #  If you are compiling the MGR version, then the following three
+ #  definitions should be uncommented.
+ #
+ MGRHOME         = /usr/mgr
+ MGRPARAM        = -DMGRHOME=\"$(MGRHOME)\"
+ MGRINCDIR       = -I$(MGRHOME)/include
  #-------------------------------------------------------------------
  
  VARIABLES       = $(FMONTYPE) $(BACKGROUND) $(FACEPARAM) \
                    $(INVERT) $(PERIOD) $(DONTSHOWNO) $(SPOOLFILE) \
  		  $(DONTSHOWTIME) $(DONTSHOWUSER)
! BINARIES        = mgr_faces ps_faces sv_faces x11_faces
  BINDIR          = /usr/local/bin
  FACES           = facedir
  LIBDIR          = /usr/local/lib
***************
*** 101,111 ****
  MANSECT         = l
  
  CFLAGS          = -g $(NEWSFILE) $(TTEXT) $(SELTYPE) \
! 		     $(ROADRUNNER) $(VARIABLES)
  HDRS            = extern.h faces.h patchlevel.h
  IMAGES          = noface.icon nomail.icon noprint.icon \
  		  nopaper.icon nousers.icon
  
  PSLIBS          = $$NEWSHOME/lib/libcps.a
  PSOBJS          = get.o main.o mon.o news.o rec.o
  PSSRCS          = get.c main.c mon.c news.c rec.c
--- 108,122 ----
  MANSECT         = l
  
  CFLAGS          = -g $(NEWSFILE) $(TTEXT) $(SELTYPE) \
! 		     $(ROADRUNNER) $(MGRPARAM) $(MGRINCDIR) $(VARIABLES)
  HDRS            = extern.h faces.h patchlevel.h
  IMAGES          = noface.icon nomail.icon noprint.icon \
  		  nopaper.icon nousers.icon
  
+ MGRLIBS         = $(MGRHOME)/lib/libmgr.a
+ MGROBJS         = get.o main.o mgr.o mon.o rec.o
+ MGRSRCS         = get.c main.c mgr.c mon.c rec.c
+ 
  PSLIBS          = $$NEWSHOME/lib/libcps.a
  PSOBJS          = get.o main.o mon.o news.o rec.o
  PSSRCS          = get.c main.c mon.c news.c rec.c
***************
*** 119,137 ****
  X11SRCS         = get.c main.c mon.c rec.c x11.c
  
  OTHERS          = README faces.1 faces.ps machine.tab people.tab Makefile
! SRCS            = get.c main.c mon.c news.c rec.c sunview.c x11.c
  
  help:
  		@echo
! 		@echo "You need to specify one of the following three options:"
  		@echo
  		@echo 1/   make sunview    - to make the SunView version.
! 		@echo 2/   make news       - to make the NeWS version.
! 		@echo 3/   make x11        - to make the X11 version.
  		@echo
  
! all:            sunview news x11
  
  news:           ps_faces
  		cp ps_faces faces
  
--- 130,152 ----
  X11SRCS         = get.c main.c mon.c rec.c x11.c
  
  OTHERS          = README faces.1 faces.ps machine.tab people.tab Makefile
! SRCS            = get.c main.c mgr.c mon.c news.c rec.c sunview.c x11.c
  
  help:
  		@echo
! 		@echo "You need to specify one of the following four options:"
  		@echo
  		@echo 1/   make sunview    - to make the SunView version.
! 		@echo 2/   make mgr        - to make the MGR version.
! 		@echo 3/   make news       - to make the NeWS version.
! 		@echo 4/   make x11        - to make the X11 version.
  		@echo
  
! all:            mgr news sunview x11
  
+ mgr:            mgr_faces
+ 		cp mgr_faces faces
+ 
  news:           ps_faces
  		cp ps_faces faces
  
***************
*** 141,146 ****
--- 156,164 ----
  x11:            x11_faces
  		cp x11_faces faces
  
+ mgr_faces:      $(MGROBJS)
+ 		cc -o mgr_faces $(CFLAGS) $(MGROBJS) $(MGRLIBS)
+ 
  ps_faces:       $(PSOBJS)
  		cc -o ps_faces $(CFLAGS) $(PSOBJS) $(PSLIBS)
  
***************
*** 161,166 ****
--- 179,185 ----
  clean:;         rm -f *.o $(BINARIES) faces core
  
  lint:;          lint -DNEWSGIVEN -DNEWSFILE=\"$(LIBDIR)/faces.ps\" $(PSSRCS)
+ 		lint $(MGRSRCS)
  		lint $(SVSRCS) $(SVLIBS)
  		lint $(X11SRCS) $(X11LIBS)
  
***************
*** 177,184 ****
  
  get.o:          get.c faces.h extern.h patchlevel.h
  main.o:         main.c faces.h Makefile
! mon.o:          mon.c faces.h extern.h
! news.o:         news.c faces.h extern.h
  rec.o:          rec.c faces.h extern.h
  sunview.o:      sunview.c faces.h extern.h $(IMAGES)
  x11.o:          x11.c faces.h extern.h $(IMAGES)
--- 196,204 ----
  
  get.o:          get.c faces.h extern.h patchlevel.h
  main.o:         main.c faces.h Makefile
! mgr.o:          mgr.c faces.h extern.h
! mon.o:          mon.c faces.h extern.h $(IMAGES)
! news.o:         news.c faces.h extern.h $(IMAGES)
  rec.o:          rec.c faces.h extern.h
  sunview.o:      sunview.c faces.h extern.h $(IMAGES)
  x11.o:          x11.c faces.h extern.h $(IMAGES)
*** original/README	Sun Feb  5 22:11:45 1989
--- README	Sat Feb 18 21:59:40 1989
***************
*** 9,22 ****
  This is the second general release of a "faces" server for
  monitoring mail or print jobs.
  
! It contains graphical interfaces for SunView, NeWS and X11.
  
! Note that you need to specify one of the following three options to
  compile faces:
  
   1/     make sunview      - to make the SunView version.
   2/     make news         - to make the NeWS version.
   3/     make x11          - to make the X11 version.
  
  This should then be followed by a make install. You might need super-user
  permission to do this successfully. Create your face directory, hostname
--- 9,23 ----
  This is the second general release of a "faces" server for
  monitoring mail or print jobs.
  
! It contains graphical interfaces for MGR, NeWS, SunView and X11.
  
! Note that you need to specify one of the following four options to
  compile faces:
  
   1/     make sunview      - to make the SunView version.
   2/     make news         - to make the NeWS version.
   3/     make x11          - to make the X11 version.
+  4/     make mgr          - to make the MGR version.
  
  This should then be followed by a make install. You might need super-user
  permission to do this successfully. Create your face directory, hostname
*** original/faces.1	Sun Feb  5 22:11:45 1989
--- faces.1	Sat Feb 18 21:59:41 1989
***************
*** 1,4 ****
! .\" @(#)faces.1 1.6 89/02/05
  .TH FACES 1L "2 December 1988"
  .SH NAME
  faces \- visual mail, user and print face server.
--- 1,4 ----
! .\" @(#)faces.1 1.7 89/02/18
  .TH FACES 1L "2 December 1988"
  .SH NAME
  faces \- visual mail, user and print face server.
***************
*** 71,84 ****
  .SH DESCRIPTION
  .B faces
  is a window based tool for monitoring mail, users or print queues. It contains
! graphical interfaces for SunView, NeWS and X11. It has four different modes
! of operation:
  .LP
  The default will monitor for new mail. Only the last ten messages are
  displayed. In its iconic form, it is also possible to display the timestamp
  of each message, and the open window format can give the username. The left
! mouse button can be used with the open window, to clear the display so that
! only new mail is shown.
  .LP
  The second choice is to monitor the whole of a mail file. The icon and open
  window display the appropriate faces, and dynamically change size as a new
--- 71,84 ----
  .SH DESCRIPTION
  .B faces
  is a window based tool for monitoring mail, users or print queues. It contains
! graphical interfaces for MGR, NeWS, SunView, and X11. It has four different
! modes of operation:
  .LP
  The default will monitor for new mail. Only the last ten messages are
  displayed. In its iconic form, it is also possible to display the timestamp
  of each message, and the open window format can give the username. The left
! mouse button (middle button with MGR) can be used with the open window, to
! clear the display so that only new mail is shown.
  .LP
  The second choice is to monitor the whole of a mail file. The icon and open
  window display the appropriate faces, and dynamically change size as a new
***************
*** 96,101 ****
--- 96,104 ----
  is displayed. The iconic form displays login time, and the window format gives
  the username.
  .LP
+ With the MGR version, swapping between the open window and the iconic versions
+ is done with the right mouse button.
+ .LP
  There are special displays for no mail, no faces found, no print jobs,
  no paper in the printer, and no users logged into a machine.
  .LP
***************
*** 137,145 ****
  .LP
  The iconname above, consists of the following choices, in the given order:
  .LP
! 	SunView - sun.icon, 48x48x1, face.xbm
  .br
  	NeWS - face.ps, sun.icon, 48x48x1, face.xbm
  .br
  	X11 - face.xbm, sun.icon, 48x48x1
  .LP
--- 140,150 ----
  .LP
  The iconname above, consists of the following choices, in the given order:
  .LP
! 	MGR - sun.icon, 48x48x1, face.xbm
  .br
  	NeWS - face.ps, sun.icon, 48x48x1, face.xbm
+ .br
+ 	SunView - sun.icon, 48x48x1, face.xbm
  .br
  	X11 - face.xbm, sun.icon, 48x48x1
  .LP
*** original/faces.h	Sun Jan 29 12:48:19 1989
--- faces.h	Sat Feb 18 21:59:39 1989
***************
*** 1,5 ****
  
! /*  @(#)faces.h 1.7 89/01/29
   *
   *  Contains all the global definitions used by faces.
   *
--- 1,5 ----
  
! /*  @(#)faces.h 1.8 89/02/18
   *
   *  Contains all the global definitions used by faces.
   *
***************
*** 21,26 ****
--- 21,27 ----
  #include <sys/stat.h>
  #include <sys/time.h>
  #include <pwd.h>
+ #include <signal.h>
  #include <strings.h>
  #include <netdb.h>
  
***************
*** 41,47 ****
  #define  STRCPY        (void) strcpy
  #define  STRNCAT       (void) strncat
  #define  STRNCPY       (void) strncpy
! #define  UNLINK        (void) unlink
  
  /* The types of display. */
  enum disp_type { BOTH, ICON, WINDOW } ;
--- 42,48 ----
  #define  STRCPY        (void) strcpy
  #define  STRNCAT       (void) strncat
  #define  STRNCPY       (void) strncpy
! #define  WRITE         (void) write
  
  /* The types of display. */
  enum disp_type { BOTH, ICON, WINDOW } ;
***************
*** 58,65 ****
  /* Different types of file monitoring performed by this program. */
  enum mon_type { MONALL, MONNEW, MONPRINTER, MONUSERS } ;
  
! /* Different graphics systems appropriate one set in gtype. */
! enum gr_type { SVIEW, NEWS, X11 } ;
  
  /* Determine order for face type lookup. */
  #define  NEWSTYPE        0
--- 59,66 ----
  /* Different types of file monitoring performed by this program. */
  enum mon_type { MONALL, MONNEW, MONPRINTER, MONUSERS } ;
  
! /* Different graphics systems. Appropriate one set in gtype. */
! enum gr_type { SVIEW, NEWS, X11, MGR } ;
  
  /* Determine order for face type lookup. */
  #define  NEWSTYPE        0
***************
*** 77,83 ****
--- 78,88 ----
  #define  ICONHEIGHT      64   /* Height of individual face icons. */
  #define  ICONWIDTH       64   /* Width of individual face icons. */
  #define  INC             argc-- ; argv++ ;
+ 
+ #ifndef  MAXLINE
  #define  MAXLINE         200  /* Maximum length for character strings. */
+ #endif   MAXLINE
+ 
  #define  MAXTYPES        4    /* Maximum number of different face types. */
  #define  NO_PER_ROW      10   /* Number of faces per row. */
  
*** original/mgr.c	Sat Feb 18 22:00:10 1989
--- mgr.c	Sat Feb 18 21:59:43 1989
***************
*** 0 ****
--- 1,431 ----
+ /*LINTLIBRARY*/
+ #ifndef lint
+ static char sccsid[] = "@(#)mgr.c 1.2 89/02/18" ;
+ #endif
+ 
+ /*  MGR dependent graphics routines used by faces,
+  *  the visual mail and print job monitor.
+  * 
+  *  Copyright (c) Rich Burridge - Sun Microsystems Australia.
+  *                                All rights reserved.
+  *
+  *  Permission is given to distribute these sources, as long as the
+  *  copyright messages are not removed, and no monies are exchanged. 
+  * 
+  *  No responsibility is taken for any errors on inaccuracies inherent
+  *  either to the comments or the code of this program, but if reported
+  *  to me, then an attempt will be made to fix them.
+  */
+ 
+ #include "dump.h"
+ #include "term.h"
+ #include "faces.h"
+ #include "extern.h"
+ 
+ static unsigned short noface_image[] = {
+ #include "noface.icon"
+ } ;
+ 
+ static unsigned short nomail_image[] = {
+ #include "nomail.icon"
+ } ;
+ 
+ static unsigned short nopaper_image[] = {
+ #include "nopaper.icon"
+ } ;
+ 
+ static unsigned short noprint_image[] = {
+ #include "noprint.icon"
+ } ;
+ 
+ static unsigned short nousers_image[] = {
+ #include "nousers.icon"
+ } ;
+ 
+ #ifdef NO_4.3SELECT
+ int fullmask ;               /* Full mask of file descriptors to check on. */
+ int readmask ;               /* Readmask used in select call. */
+ #else
+ fd_set fullmask ;            /* Full mask of file descriptors to check on. */
+ fd_set readmask ;            /* Readmask used in select call. */
+ #endif NO_4.3SELECT
+ 
+ /* Descriptors for various faces pixrects. */
+ #define  OLD_PR      1        /* Old pixrect for open window faces. */
+ #define  OLD_MPR     2        /* Old pixrect for icon window faces. */
+ #define  PR          3        /* Current pixrect for open window faces. */
+ #define  MPR         4        /* Current pixrect for icon window faces. */
+ #define  PR_BACK     5        /* Background image or gray pattern. */
+ #define  PR_NOFACE   6        /* No face database present face image. */
+ #define  PR_NOMAIL   7        /* No mail face image. */
+ #define  PR_NOPAPER  8        /* No paper face image. */
+ #define  PR_NOPRINT  9        /* No jobs for printer face image. */
+ #define  PR_NOUSERS  10       /* No users for machine face image. */
+ #define  PR_ORD      11       /* Ordinary face database icon face image. */
+ 
+ #define  SFONT       1        /* Descriptor for the small font. */
+ #define  SMALLFONT   "cour6x12r.fnt"
+ 
+ char fontname[MAXLINE] ;      /* Full pathname of the small font. */
+ int clean() ;                 /* Tidy up routine when finished. */
+ int frame ;                   /* Descriptor for the faces window frame. */
+ int local_mode ;              /* Used by load_icon for correct line mode. */
+ int mgr_infd ;                /* MGR input connection file descriptor. */
+ int mgr_outfd ;               /* MGR output connection file descriptor. */
+ unsigned short ibuf[256] ;   /* Ikon/icon image buffer. */
+ 
+ 
+ add_face(display, itype, name)
+ enum disp_type display ;
+ enum icon_type itype ;
+ char *name ;
+ {
+   unsigned short buf[256] ;  /* Ikon/icon image. */
+   unsigned short *ptr ;
+   int face_pr ;              /* Descriptor for current "face" image. */
+   int i ;
+  
+   switch ((int) itype)
+     {
+       case NOMAIL   : face_pr = PR_NOMAIL ;
+                       break ;
+       case NOPAPER  : face_pr = PR_NOPAPER ;
+                       break ;
+       case NOPRINT  : face_pr = PR_NOPRINT ;
+                       break ;
+       case NOUSERS  : face_pr = PR_NOUSERS ;
+                       break ;
+       case ORDINARY : if (get_icon(name, buf) == -1) face_pr = PR_NOFACE ;
+                       else
+                         {
+                           face_pr = PR_ORD ;
+                           load_icon(PR_ORD, buf) ;
+                         }
+                       break ;
+     }
+   if (display == ICON)
+     if (mtype == MONPRINTER) adjust_image(MPR, face_pr, 0, 0) ;
+     else adjust_image(MPR, face_pr, row, column) ;
+   else if (display == WINDOW) adjust_image(PR, face_pr, row, column) ;
+   else
+     { 
+       adjust_image(MPR, face_pr, row, column) ;
+       adjust_image(PR, face_pr, row, column) ;
+     }
+ }
+ 
+ 
+ adjust_image(fpr, face_pr, row, column)    /* Place face in memory pixrect. */
+ int fpr, face_pr, row, column ;
+ {
+   m_func(B_COPY) ;
+   switch ((int) mtype)
+     {
+       case MONNEW     : m_bitcopyto(64, 0, (NO_PER_ROW-1)*ICONWIDTH,
+                                     ICONHEIGHT, 0, 0, fpr, fpr) ;
+       case MONALL     :
+       case MONPRINTER :
+       case MONUSERS   : m_bitcopyto(column*ICONWIDTH, row*ICONHEIGHT,
+                               ICONWIDTH, ICONHEIGHT, 0, 0,  fpr, face_pr) ;
+     }
+   m_flush() ;
+ }
+ 
+ 
+ /*ARGSUSED*/
+ beep_flash(beeps, flashes)    /* Perform visual feedback. */
+ int beeps, flashes ;
+ {
+   int i ;
+ 
+   for (i = 0; i < beeps; i++) m_bell() ;    /* Flash window and sound bell. */
+ }
+ 
+ 
+ clean(code)
+ int code ;
+ {
+   m_bitdestroy(1) ;
+   m_pop() ;
+   m_ttyreset() ;
+   exit(code) ;
+ }
+ 
+ 
+ create_pixrects(width, height)        /* Create pixrects for the face images. */
+ {
+   m_func(B_COPY) ;
+   if (mtype == MONNEW && !firsttime)
+     {
+       m_bitcopyto(0, 0, width, height, 0, 0, OLD_PR, PR) ;
+       m_bitcopyto(0, 0, width, height, 0, 0, OLD_MPR, MPR) ;
+     }
+   m_bitcreate(PR, width, height) ;
+   do_background(PR) ;
+   if (mtype == MONPRINTER) m_bitcreate(MPR, ICONWIDTH, ICONHEIGHT) ;
+   else
+     { 
+       m_bitcreate(MPR, width, height) ;
+       do_background(MPR) ;
+     }
+   if (mtype == MONNEW && !firsttime)
+     {
+       m_bitcopyto(0, 0, width, height, 0, 0, PR, OLD_PR) ;
+       m_bitcopyto(0, 0, width, height, 0, 0, MPR, OLD_MPR) ;
+     }
+ }
+ 
+ 
+ do_background(pixrect)     /* Set up background pattern. */
+ int pixrect ;
+ {
+   int i, j ;
+ 
+   m_func(B_COPY) ;
+   for (i = 0; i < (height / ICONHEIGHT); i++)
+     for (j = 0; j < (width / ICONWIDTH); j++)
+       m_bitcopyto(j*ICONWIDTH, i*ICONHEIGHT, ICONWIDTH, ICONHEIGHT,
+                   0, 0, pixrect, PR_BACK) ;
+ }
+ 
+ 
+ handle_mouse()     /* Clear canvas to background and recheck for new mail. */
+ {
+   if (iconic) do_background(MPR) ;
+   else do_background(PR) ;
+   do_check() ;
+ }
+ 
+ 
+ init_ws_type()
+ {
+   m_setup(M_FLUSH) ;     /* Setup I/O; turn on flushing. */
+   m_push(P_BITMAP | P_MENU | P_EVENT | P_FONT | P_FLAGS | P_POSITION) ;
+   mgr_infd = fileno(m_termin) ;
+   mgr_outfd = fileno(m_termout) ;
+ 
+   signal(SIGHUP, clean) ;
+   signal(SIGINT, clean) ;
+   signal(SIGTERM, clean) ;
+   m_ttyset() ;
+   m_setmode(M_NOWRAP) ;
+   m_setmode(M_ABS) ;
+   m_func(B_COPY) ;
+   STRCPY(fname[0], "sun.icon") ;
+   STRCPY(fname[1], "48x48x1") ;
+   STRCPY(fname[2], "face.xbm") ;
+   maxtypes = 3 ;
+ 
+   gtype = MGR ;
+   return(0) ;
+ }
+ 
+ 
+ load_icon(pixrect, ibuf)
+ int pixrect ;
+ unsigned short ibuf[256] ;
+ {
+   int fd, size ;
+ 
+   IOCTL(mgr_outfd, TIOCLGET, &local_mode) ;
+   local_mode |= LLITOUT ;
+   IOCTL(mgr_outfd, TIOCLSET, &local_mode) ;
+ 
+   size = ICONHEIGHT * (((ICONWIDTH + 15) &~ 15) >> 3) ;
+   m_bitldto(ICONWIDTH, ICONHEIGHT, 0, 0, pixrect, size) ;
+   m_flush() ;
+   WRITE(mgr_outfd, (char *) ibuf, size) ;
+ 
+   local_mode &= ~LLITOUT ;
+   IOCTL(mgr_outfd, TIOCLSET, &local_mode) ;
+ }
+ 
+ 
+ /*ARGSUSED*/
+ make_frame(argc, argv)
+ int argc ;
+ char *argv[] ;
+ {
+   int i, j ;
+ 
+ #ifdef NO_4.3SELECT
+   fullmask = 1 << mgr_infd ;
+ #else
+   FD_ZERO(&fullmask) ;
+   FD_SET(mgr_infd, &fullmask) ;
+ #endif NO_4.3SELECT
+ 
+   for (i = 0; i < 16; i++)    /* Load default gray background. */
+     {
+       for (j = 0; j < 4; j++) ibuf[i*16+j] = 0x8888 ;
+       for (j = 0; j < 4; j++) ibuf[i*16+4+j] = 0x2222 ;
+       for (j = 0; j < 4; j++) ibuf[i*16+8+j] = 0x4444 ;
+       for (j = 0; j < 4; j++) ibuf[i*16+12+j] = 0x1111 ;
+     }
+   if (strlen(bgicon)) GET_SUN_ICON(bgicon, ibuf) ;
+   load_icon(PR_BACK, ibuf) ;
+ 
+ #ifdef MGRHOME
+   SPRINTF(fontname, "%s/font/%s", MGRHOME, SMALLFONT) ;
+ #else
+   SPRINTF(fontname, "/usr/mgr/font/%s", MGRHOME, SMALLFONT) ;
+ #endif
+ 
+   m_loadfont(SFONT, fontname) ;
+   m_font(SFONT) ;
+   m_setevent(BUTTON_1, "b\r") ;    /* Check for right mouse button. */
+   m_setevent(BUTTON_2, "B\r") ;    /* Check for middle mouse button press. */
+   m_setevent(DESTROY, "D\r") ;     /* Check for window being destroyed. */
+   m_setevent(RESHAPE, "S\r") ;     /* Check for window being reshaped. */
+   m_setevent(REDRAW, "R\r") ;      /* Check for window being redrawn. */
+   width = NO_PER_ROW * ICONWIDTH ;
+   height = ICONHEIGHT ;
+ }
+ 
+ 
+ make_icon()
+ {
+   load_icon(PR_NOFACE, noface_image) ;
+   load_icon(PR_NOMAIL, nomail_image) ;
+   load_icon(PR_NOPAPER, nopaper_image) ;
+   load_icon(PR_NOPRINT, noprint_image) ;
+   load_icon(PR_NOUSERS, nousers_image) ;
+ }
+ 
+ 
+ repaint_proc()       /* Repaint the faces window (open or iconic). */
+ {
+   int x, y, w, h ;   /* Position and size of faces window. */
+ 
+   m_func(B_COPY) ;
+   get_size(&x, &y, &w, &h) ;
+   if (iconic)
+     {
+       if (firsttime)
+         {
+           x = ix ;
+           y = iy ;
+         }
+       if (mtype != MONPRINTER)
+         {
+           m_shapewindow(x, y, width+10, height+10) ;
+           m_bitcopyto(0, 0, width, height, 0, 0, 0, MPR) ;
+         }
+       else
+         { 
+           m_shapewindow(x, y, ICONWIDTH+10, ICONHEIGHT+10) ;
+           m_bitcopyto(0, 0, ICONWIDTH, ICONHEIGHT, 0, 0, 0, MPR) ;
+         }
+     }     
+   else
+     {
+       if (firsttime)
+         {
+           x = wx ;
+           y = wy ;
+         }
+       m_shapewindow(x, y, width+10, height+10) ;
+       m_bitcopyto(0, 0, width, height, 0, 0, 0, PR) ;
+     }
+ }
+ 
+ 
+ show_display()       /* Show the latest set of mail icon faces. */
+ {
+   int x, y, w, h ;   /* Position and size of faces window. */
+ 
+   if (invert)        /* Invert the memory pixrects before displaying. */
+     {
+       m_func(B_INVERT) ;
+       m_bitwriteto(0, 0, width, height, PR) ;
+       m_bitwriteto(0, 0, width, height, MPR) ;
+     }
+   repaint_proc() ;   /* Repaint the faces window (open or iconic). */
+   if (newmail) beep_flash(beeps, flashes) ;
+   m_clearmode(M_ACTIVATE) ;
+ }
+ 
+ 
+ start_tool()
+ {
+   char line[MAXLINE] ;           /* Next "event" from MGR server. */
+   struct timeval tval ;
+ 
+   tval.tv_usec = 0 ;
+   tval.tv_sec = period ;
+ 
+   m_flush() ;
+   for (;;)
+     {
+       readmask = fullmask ;
+ #ifdef NO_4.3SELECT
+       SELECT(32, &readmask, 0, 0, &tval) ;
+       if (readmask && (1 << mgr_infd))
+ #else
+       SELECT(FD_SETSIZE, &readmask, (fd_set *) 0, (fd_set *) 0, &tval) ;
+       if (FD_ISSET(mgr_infd, &readmask))
+ #endif NO_4.3SELECT
+         {
+           if (m_gets(line) == NULL)
+             {
+               clearerr(m_termin) ;
+               continue ;
+             }
+           switch (*line)
+             {
+               case 'B' : if (mtype == MONNEW) handle_mouse() ;
+                          break ;
+               case 'D' : clean(0) ;         /* Window destroyed. */
+               case 'b' : iconic = !iconic ; /* Show other display. */
+               case 'R' :                    /* Window redrawn. */
+               case 'S' : repaint_proc() ;   /* Window reshaped. */
+             }
+         }
+       else do_check() ;        /* Check the mail/printer again. */
+     }
+ }
+ 
+ 
+ text(display, just, str)
+ enum disp_type display ;
+ enum just_type just ;
+ char *str ;
+ {
+   int len ;
+   int c, r ;         /* Column and row position for this face. */
+   int tpr ;          /* Descriptor for this memory pixrect. */
+   int x, y ;         /* Position of start of this text string. */
+ 
+   c = column ;
+   r = row ;
+   switch ((int) display)
+     {
+       case BOTH   : text(ICON, just, str) ;
+                     text(WINDOW, just, str) ;
+                     return ;
+       case ICON   : tpr = MPR ;
+                     if ((mtype == MONNEW) || (mtype == MONPRINTER))
+                       c = r = 0 ;
+                     break ;
+       case WINDOW : tpr = PR ;
+     }
+ 
+   len = strlen(str) ;              /* Character length of text. */
+   if (len > 10)
+     {
+       len = 10 ;
+       str[10] = '\0' ;   /* Maximum of 10 characters. */
+     }
+   switch ((int) just)
+     {
+       case LEFT  : x = c*ICONWIDTH+2 ;
+                    y = (r+1)*ICONHEIGHT-2 ;
+                    break ;
+       case RIGHT : x = (c+1)*ICONWIDTH-(len*6)-2 ;
+                    y = (r+1)*ICONHEIGHT-2 ;
+     }
+   m_func(B_CLEAR) ;
+   m_bitwriteto(x, y-9, len*6+2, 10, tpr) ;
+   m_func(B_COPY) ;
+   m_stringto(tpr, x, y, str) ;
+ }
*** original/patchlevel.h	Sun Feb  5 22:11:45 1989
--- patchlevel.h	Sat Feb 18 21:59:39 1989
***************
*** 1,5 ****
   
! /*  @(#)patchlevel.h 1.8 89/02/05
   *
   *  This is the current patch level for this version of faces.
   *
--- 1,5 ----
   
! /*  @(#)patchlevel.h 1.9 89/02/18
   *
   *  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  7
--- 14,17 ----
   *  reported to me then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  8