		      Release 5 Public Patch #20
			   MIT X Consortium

To apply this patch:

cd to the top of the source tree (to the directory containing the "mit"
and "contrib" subdirectories) and do:
	patch -p -s < ThisFile
Patch will work silently unless an error occurs.
If you want to watch patch do its thing, leave out the "-s" argument to patch.

Finally, to rebuild after applying this patch, cd to the "mit" subdirectory
and do:
	make Everything >& every.log
Note: this will *not* "clean" your tree.


Brief notes on what this patch fixes:

Xlib: XPolygonRegion can produce non-YXBanded region
Xlib: out of bounds reference in XRegion code
Xt: typo in debug routine _XtConverterCacheStats()
Xt: in resource conversion, dereferenced pointer can be null
Xt: _XtCreate may free args pointer too early
Xt: enter/leave event compression not quite correct
Xt: core dump in Keyboard.c when gadget with focus is destroyed
Xt: unnecessary call to XtUnmapWidget in XtPopdown
Xt: XtPopup prototype declaration requires new-style function definition
Xt: SelectionClear event handler can erroneously clear ownership
Xt: memory leak when two widgets in a client swap selection ownership
Xt: Shell does not correctly update x,y when reparented back to root
Xt: XtSetValues on XtNargv/XtNargc of ApplicationShell is ignored
Xt: per-display keysym info referenced before being set
Xt: alloca decl needs to coexist with possible macro def
Xt: for broken shared libs, don't refer to vendorShell directly
Xmu: xstdcmap on a 24 plane true/direct color dies/hangs
Xaw: missing brackets cause miscalculation of SimpleMenu height
Xaw: query-replace in Text widget broken
Xaw: XawTextReplace should not always enable redisplay
fontlib: X server dies when some clients receive lines > 256 char
fontlib: fs_get_metrics should not do default character substitution
xdm: $HOME not reset if directory nonexistent
xdm: need to set ulimits under AIXV3 when login
PEXlib: Imakefile installs shared library in wrong directory
PEXlib: problems with PEXQueryTextExtents and PEXQueryEncodedTextExtents

Prereq: public-patch-19

*** /tmp/da05812	Mon Nov 23 18:18:56 1992
--- mit/bug-report	Mon Nov 23 18:18:56 1992
***************
*** 2,8 ****
  Subject: [area]: [synopsis]   [replace with actual area and short description]
  
  VERSION:
!     R5, public-patch-19
      [MIT public patches will edit this line to indicate the patch level]
  
  CLIENT MACHINE and OPERATING SYSTEM:
--- 2,8 ----
  Subject: [area]: [synopsis]   [replace with actual area and short description]
  
  VERSION:
!     R5, public-patch-20
      [MIT public patches will edit this line to indicate the patch level]
  
  CLIENT MACHINE and OPERATING SYSTEM:
*** /tmp/da05835	Mon Nov 23 18:18:58 1992
--- mit/lib/X/XPolyReg.c	Mon Nov 23 18:18:58 1992
***************
*** 1,4 ****
! /* $XConsortium: XPolyReg.c,v 11.20 91/06/08 11:31:09 rws Exp $ */
  /************************************************************************
  Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
--- 1,4 ----
! /* $XConsortium: XPolyReg.c,v 11.21 92/09/15 14:22:38 rws Exp $ */
  /************************************************************************
  Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
***************
*** 376,383 ****
      register POINTBLOCK *CurPtBlock;
      register int i;
      register BOX *extents;
!     int numRects;
!     Bool first;
   
      extents = &reg->extents;
   
--- 376,382 ----
      register POINTBLOCK *CurPtBlock;
      register int i;
      register BOX *extents;
!     register int numRects;
   
      extents = &reg->extents;
   
***************
*** 389,395 ****
      reg->size = numRects;
      CurPtBlock = FirstPtBlock;
      rects = reg->rects - 1;
!     first = True;
      extents->x1 = MAXSHORT,  extents->x2 = MINSHORT;
   
      for ( ; numFullPtBlocks >= 0; numFullPtBlocks--) {
--- 388,394 ----
      reg->size = numRects;
      CurPtBlock = FirstPtBlock;
      rects = reg->rects - 1;
!     numRects = 0;
      extents->x1 = MAXSHORT,  extents->x2 = MINSHORT;
   
      for ( ; numFullPtBlocks >= 0; numFullPtBlocks--) {
***************
*** 398,414 ****
  	if (!numFullPtBlocks)
  	    i = iCurPtBlock >> 1;
  	for (pts = CurPtBlock->pts; i--; pts += 2) {
! 	    if (pts->x == pts[1].x) {
! 		numRects--;
  		continue;
! 	    }
! 	    if (!first && pts->x == rects->x1 && pts->y == rects->y2 &&
! 		pts[1].x == rects->x2) {
  		rects->y2 = pts[1].y + 1;
- 		numRects--;
  		continue;
  	    }
! 	    first = False;
  	    rects++;
  	    rects->x1 = pts->x;  rects->y1 = pts->y;
  	    rects->x2 = pts[1].x;  rects->y2 = pts[1].y + 1;
--- 397,412 ----
  	if (!numFullPtBlocks)
  	    i = iCurPtBlock >> 1;
  	for (pts = CurPtBlock->pts; i--; pts += 2) {
! 	    if (pts->x == pts[1].x)
  		continue;
! 	    if (numRects && pts->x == rects->x1 && pts->y == rects->y2 &&
! 		pts[1].x == rects->x2 &&
! 		(numRects == 1 || rects[-1].y1 != rects->y1) &&
! 		(!i || pts[2].y > pts[1].y)) {
  		rects->y2 = pts[1].y + 1;
  		continue;
  	    }
! 	    numRects++;
  	    rects++;
  	    rects->x1 = pts->x;  rects->y1 = pts->y;
  	    rects->x2 = pts[1].x;  rects->y2 = pts[1].y + 1;
*** /tmp/da05857	Mon Nov 23 18:19:01 1992
--- mit/lib/X/XRegion.c	Mon Nov 23 18:19:00 1992
***************
*** 1,4 ****
! /* $XConsortium: XRegion.c,v 11.33 91/06/08 09:55:26 rws Exp $ */
  /************************************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
--- 1,4 ----
! /* $XConsortium: XRegion.c,v 11.36 92/10/21 10:05:54 rws Exp $ */
  /************************************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
***************
*** 54,60 ****
  #include "poly.h"
  
  #ifdef DEBUG
! #define assert(expr) {if (!(expr)) FatalError(\
  "Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__); }
  #else
  #define assert(expr)
--- 54,61 ----
  #include "poly.h"
  
  #ifdef DEBUG
! #include <stdio.h>
! #define assert(expr) {if (!(expr)) fprintf(stderr,\
  "Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__); }
  #else
  #define assert(expr)
***************
*** 1346,1352 ****
  		 * reset left fence to edge of new minuend.
  		 */
  		r1++;
! 		x1 = r1->x1;
  	    }
  	    else
  	    {
--- 1347,1354 ----
  		 * reset left fence to edge of new minuend.
  		 */
  		r1++;
! 		if (r1 != r1End)
! 		    x1 = r1->x1;
  	    }
  	    else
  	    {
***************
*** 1381,1387 ****
  		 * Minuend used up: advance to new...
  		 */
  		r1++;
! 		x1 = r1->x1;
  	    }
  	    else
  	    {
--- 1383,1390 ----
  		 * Minuend used up: advance to new...
  		 */
  		r1++;
! 		if (r1 != r1End)
! 		    x1 = r1->x1;
  	    }
  	    else
  	    {
*** /tmp/da05901	Mon Nov 23 18:19:05 1992
--- mit/lib/Xt/Convert.c	Mon Nov 23 18:19:05 1992
***************
*** 1,4 ****
! /* $XConsortium: Convert.c,v 1.65 92/02/27 17:08:12 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Convert.c,v 1.67 92/08/31 17:02:24 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 446,452 ****
  	    for (p = cacheHashTable[i]; p; p = p->next) {
  		(void) fprintf(stdout, "    Size: %3d  Refs: %3d  '",
  			       p->from.size,
! 			       p->has_ext ? CEXT(p)->ref_count) : 0;
  		(void) fprintf(stdout, "'\n");
  	    }
  	    (void) fprintf(stdout, "\n");
--- 446,452 ----
  	    for (p = cacheHashTable[i]; p; p = p->next) {
  		(void) fprintf(stdout, "    Size: %3d  Refs: %3d  '",
  			       p->from.size,
! 			       p->has_ext ? CEXT(p)->ref_count : 0);
  		(void) fprintf(stdout, "'\n");
  	    }
  	    (void) fprintf(stdout, "\n");
***************
*** 746,752 ****
  
  	if (retval == False && supplied_size < to->size) {
  	    /* programmer error: caller must allocate sufficient storage */
! 	    *cache_ref_return = NULL;
  	    return False;
  	}
  
--- 746,753 ----
  
  	if (retval == False && supplied_size < to->size) {
  	    /* programmer error: caller must allocate sufficient storage */
! 	    if (cache_ref_return)
! 		*cache_ref_return = NULL;
  	    return False;
  	}
  
*** /tmp/da05923	Mon Nov 23 18:19:08 1992
--- mit/lib/Xt/Create.c	Mon Nov 23 18:19:07 1992
***************
*** 1,4 ****
! /* $XConsortium: Create.c,v 1.88 92/05/11 16:38:19 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Create.c,v 1.89 92/08/26 14:09:28 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 261,266 ****
--- 261,277 ----
      req_widget = (Widget) XtStackAlloc(wsize, widget_cache);
      bcopy ((char *) widget, (char *) req_widget, (int) wsize);
      CallInitialize (XtClass(widget), req_widget, widget, args, num_args);
+     if (parent_constraint_class != NULL) {
+ 	if (csize) {
+ 	    req_constraints = XtStackAlloc(csize, constraint_cache);
+ 	    bcopy(widget->core.constraints, (char*)req_constraints,(int)csize);
+ 	    req_widget->core.constraints = req_constraints;
+ 	} else req_widget->core.constraints = NULL;
+ 	CallConstraintInitialize(parent_constraint_class, req_widget, widget,
+ 				 args, num_args);
+ 	if (csize) XtStackFree(req_constraints, constraint_cache);
+     }
+     XtStackFree((XtPointer)req_widget, widget_cache);
  
      if (typed_args != NULL) {
  	while (num_typed_args-- > 0) {
***************
*** 277,297 ****
  	    }
  	    typed_args++;
  	}
- 
  	DEALLOCATE_LOCAL((char*)args);
      }
- 
-     if (parent_constraint_class != NULL) {
- 	if (csize) {
- 	    req_constraints = XtStackAlloc(csize, constraint_cache);
- 	    bcopy(widget->core.constraints, (char*)req_constraints,(int)csize);
- 	    req_widget->core.constraints = req_constraints;
- 	} else req_widget->core.constraints = NULL;
- 	CallConstraintInitialize(parent_constraint_class, req_widget, widget,
- 				 args, num_args);
- 	if (csize) XtStackFree(req_constraints, constraint_cache);
-     }
-     XtStackFree((XtPointer)req_widget, widget_cache);
      return (widget);
  }
  
--- 288,295 ----
*** /tmp/da05945	Mon Nov 23 18:19:10 1992
--- mit/lib/Xt/Event.c	Mon Nov 23 18:19:10 1992
***************
*** 1,4 ****
! /* $XConsortium: Event.c,v 1.136 92/02/21 15:54:06 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Event.c,v 1.137 92/11/19 17:24:47 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 607,613 ****
  	    XPeekEvent(event->xcrossing.display, &nextEvent);
  	    if (nextEvent.type == LeaveNotify &&
  		  event->xcrossing.window == nextEvent.xcrossing.window &&
! 		  event->xcrossing.subwindow == nextEvent.xcrossing.subwindow){
  		/* skip the enter/leave pair */
  		XNextEvent(event->xcrossing.display, &nextEvent);
  		return XtDidNothing;
--- 607,616 ----
  	    XPeekEvent(event->xcrossing.display, &nextEvent);
  	    if (nextEvent.type == LeaveNotify &&
  		  event->xcrossing.window == nextEvent.xcrossing.window &&
! 		(event->xcrossing.detail != NotifyInferior &&
! 		 nextEvent.xcrossing.detail != NotifyInferior ||
! 		 event->xcrossing.detail == NotifyInferior &&
! 		 nextEvent.xcrossing.detail == NotifyInferior)) {
  		/* skip the enter/leave pair */
  		XNextEvent(event->xcrossing.display, &nextEvent);
  		return XtDidNothing;
*** /tmp/da05967	Mon Nov 23 18:19:12 1992
--- mit/lib/Xt/Keyboard.c	Mon Nov 23 18:19:12 1992
***************
*** 1,4 ****
! /* $XConsortium: Keyboard.c,v 1.25 92/04/22 16:49:33 rws Exp $ */
  
  /********************************************************
  
--- 1,4 ----
! /* $XConsortium: Keyboard.c,v 1.26 92/10/06 14:01:53 converse Exp $ */
  
  /********************************************************
  
***************
*** 690,697 ****
  {
      XtSetKeyboardFocus((Widget)closure, None);
      /* invalidate FindKeyDestination's ancestor list if it is still for us */
!     if (pseudoTraceDepth && pseudoTraceDisplay == XtDisplay(widget) &&
! 	widget == pseudoTrace[0])
  	pseudoTraceDepth = 0;
  }
  
--- 690,698 ----
  {
      XtSetKeyboardFocus((Widget)closure, None);
      /* invalidate FindKeyDestination's ancestor list if it is still for us */
!     if (pseudoTraceDepth &&
! 	pseudoTraceDisplay == XtDisplay((Widget)closure) &&
! 	_GetWindowedAncestor(widget) == pseudoTrace[0])
  	pseudoTraceDepth = 0;
  }
  
*** /tmp/da05989	Mon Nov 23 18:19:14 1992
--- mit/lib/Xt/Popup.c	Mon Nov 23 18:19:14 1992
***************
*** 1,4 ****
! /* $XConsortium: Popup.c,v 1.30 91/05/09 18:07:59 swick Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Popup.c,v 1.32 92/08/13 17:52:38 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 72,80 ****
--- 72,84 ----
  
  } /* _XtPopup */
  
+ #if NeedFunctionPrototypes
+ void XtPopup (Widget widget, XtGrabKind grab_kind)
+ #else
  void XtPopup (widget, grab_kind)
      Widget  widget;
      XtGrabKind grab_kind;
+ #endif
  {
      switch (grab_kind) {
  
***************
*** 117,123 ****
  
      if (shell_widget->shell.popped_up) {
  	XtGrabKind grab_kind = shell_widget->shell.grab_kind;
- 	XtUnmapWidget(widget);
  	XWithdrawWindow(XtDisplay(widget), XtWindow(widget),
  			XScreenNumberOfScreen(XtScreen(widget)));
  	if (grab_kind != XtGrabNone) {
--- 121,126 ----
*** /tmp/da06011	Mon Nov 23 18:19:17 1992
--- mit/lib/Xt/Selection.c	Mon Nov 23 18:19:16 1992
***************
*** 1,4 ****
! /* $XConsortium: Selection.c,v 1.72 91/07/23 12:20:29 rws Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Selection.c,v 1.74 92/11/13 17:40:46 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 688,694 ****
        case SelectionClear:
  	/* if this event is not for the selection we registered for,
  	 * don't do anything */
! 	if (ctx->selection != event->xselectionclear.selection)
  	    break;
  	(void) LoseSelection(ctx, widget, event->xselectionclear.selection,
  			event->xselectionclear.time);
--- 688,695 ----
        case SelectionClear:
  	/* if this event is not for the selection we registered for,
  	 * don't do anything */
! 	if (ctx->selection != event->xselectionclear.selection ||
! 	    ctx->serial > event->xselectionclear.serial)
  	    break;
  	(void) LoseSelection(ctx, widget, event->xselectionclear.selection,
  			event->xselectionclear.time);
***************
*** 774,780 ****
  {
      Select ctx;
      Select oldctx = NULL;
-     Window window;
  
      if (!XtIsRealized(widget)) return False;
  
--- 775,780 ----
***************
*** 783,789 ****
  	ctx->ref_count || ctx->was_disowned)
      {
  	Boolean replacement = FALSE;
! 	window = XtWindow(widget);
          XSetSelectionOwner(ctx->dpy, selection, window, time);
          if (XGetSelectionOwner(ctx->dpy, selection) != window)
  	    return FALSE;
--- 783,790 ----
  	ctx->ref_count || ctx->was_disowned)
      {
  	Boolean replacement = FALSE;
! 	Window window = XtWindow(widget);
! 	unsigned long serial = XNextRequest(ctx->dpy);
          XSetSelectionOwner(ctx->dpy, selection, window, time);
          if (XGetSelectionOwner(ctx->dpy, selection) != window)
  	    return FALSE;
***************
*** 831,836 ****
--- 832,838 ----
  	}
  	ctx->widget = widget;	/* Selection offically changes hands. */
  	ctx->time = time;
+ 	ctx->serial = serial;
      }
      ctx->convert = convert;
      ctx->loses = lose;
***************
*** 847,855 ****
       * of the event handler and the destroy callback, so the old context
       * pointer and the record contents must be preserved for LoseSelection.
       */
!     if (oldctx)
  	(void) LoseSelection(oldctx, oldctx->widget, selection, oldctx->time);
! 
      return TRUE;
  }
  
--- 849,859 ----
       * of the event handler and the destroy callback, so the old context
       * pointer and the record contents must be preserved for LoseSelection.
       */
!     if (oldctx) {
  	(void) LoseSelection(oldctx, oldctx->widget, selection, oldctx->time);
! 	if (!oldctx->ref_count && oldctx->free_when_done)
! 	    XtFree((char*)oldctx);
!     }
      return TRUE;
  }
  
*** /tmp/da06033	Mon Nov 23 18:19:19 1992
--- mit/lib/Xt/SelectionI.h	Mon Nov 23 18:19:18 1992
***************
*** 1,4 ****
! /* $XConsortium: SelectionI.h,v 1.32 91/05/06 17:21:00 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: SelectionI.h,v 1.33 92/11/13 17:38:21 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 71,76 ****
--- 71,77 ----
      Display *dpy; 			/* constant */
      Widget widget;
      Time time;
+     unsigned long serial;
      XtConvertSelectionProc convert;
      XtLoseSelectionProc loses;
      XtSelectionDoneProc notify;
*** /tmp/da06055	Mon Nov 23 18:19:21 1992
--- mit/lib/Xt/Shell.c	Mon Nov 23 18:19:20 1992
***************
*** 1,4 ****
! /* $XConsortium: Shell.c,v 1.127 92/06/08 14:28:33 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Shell.c,v 1.129 92/09/15 13:54:28 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 558,563 ****
--- 558,564 ----
  
  static void ApplicationInitialize();
  static void ApplicationDestroy();
+ static Boolean ApplicationSetValues();
  static void ApplicationShellInsertChild();
  
  static CompositeClassExtensionRec compositeClassExtension = {
***************
*** 592,598 ****
      /* destroy            */    ApplicationDestroy,
      /* resize             */    XtInheritResize,
      /* expose             */    NULL,
!     /* set_values         */    NULL,
      /* set_values_hook    */	NULL,			
      /* set_values_almost  */	XtInheritSetValuesAlmost,
      /* get_values_hook    */	NULL,			
--- 593,599 ----
      /* destroy            */    ApplicationDestroy,
      /* resize             */    XtInheritResize,
      /* expose             */    NULL,
!     /* set_values         */    ApplicationSetValues,
      /* set_values_hook    */	NULL,			
      /* set_values_almost  */	XtInheritSetValuesAlmost,
      /* get_values_hook    */	NULL,			
***************
*** 1348,1358 ****
  
  	      case ReparentNotify:
  		if (event->xreparent.window == XtWindow(w)) {
! 		   if (event->xreparent.parent != RootWindowOfScreen(XtScreen(w)))
! 		       w->shell.client_specified &= ~_XtShellNotReparented;
! 		   else
! 		       w->shell.client_specified |= _XtShellNotReparented;
! 		   w->shell.client_specified &= ~_XtShellPositionValid;
  	        }
  		return;
  
--- 1349,1364 ----
  
  	      case ReparentNotify:
  		if (event->xreparent.window == XtWindow(w)) {
! 		   if (event->xreparent.parent !=
! 		       RootWindowOfScreen(XtScreen(w)))
! 		       w->shell.client_specified &= 
! 			   ~(_XtShellNotReparented | _XtShellPositionValid);
! 		   else {
! 		       w->core.x = event->xreparent.x;
! 		       w->core.y = event->xreparent.y;
! 		       w->shell.client_specified |= 
! 			   (_XtShellNotReparented | _XtShellPositionValid);
! 		   }
  	        }
  		return;
  
***************
*** 2077,2082 ****
--- 2083,2123 ----
      return False;
  }
  
+ 
+ /*ARGSUSED*/
+ static Boolean ApplicationSetValues(current, request, new, args, num_args)
+     Widget current, request, new;
+     ArgList args;
+     Cardinal *num_args;
+ {
+     ApplicationShellWidget nw = (ApplicationShellWidget) new;
+     ApplicationShellWidget cw = (ApplicationShellWidget) current;
+ 
+     if (cw->application.argv != nw->application.argv ||
+ 	cw->application.argc != nw->application.argc) {
+ 
+ 	if (nw->application.argc > 0) {
+ 	    int i = nw->application.argc;
+ 	    char **argp = nw->application.argv + i;
+ 	    char **argv = (char **) XtMalloc((unsigned) i * sizeof(char *));
+ 	    while (--i >= 0)
+ 		argv[i] = *--argp;
+ 	    nw->application.argv = argv;
+ 	}
+ 	if (cw->application.argc > 0 &&
+ 	    cw->application.argv != nw->application.argv)
+ 	    XtFree((char *) cw->application.argv);
+ 
+ 	if (XtIsRealized(new) && !nw->shell.override_redirect) {
+ 	    if (nw->application.argc >= 0 && nw->application.argv)
+ 		XSetCommand(XtDisplay(new), XtWindow(new),
+ 			    nw->application.argv, nw->application.argc);
+ 	    else
+ 		XDeleteProperty(XtDisplay(new), XtWindow(new), XA_WM_COMMAND);
+ 	}
+     }
+     return False;
+ }
  
  void _XtShellGetCoordinates( widget, x, y)
      Widget widget;
*** /tmp/da05829	Wed Dec  9 16:08:27 1992
--- mit/lib/Xt/Display.c	Wed Dec  9 16:08:26 1992
***************
*** 1,4 ****
! /* $XConsortium: Display.c,v 1.85 92/06/08 11:24:21 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Display.c,v 1.86 92/11/23 15:32:29 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 115,120 ****
--- 115,121 ----
      pd->defaultKeycodeTranslator = XtTranslateKey;
      pd->keysyms_serial = 0;
      pd->keysyms = NULL;
+     XDisplayKeycodes(dpy, &pd->min_keycode, &pd->max_keycode);
      pd->modKeysyms = NULL;
      pd->modsToKeysyms = NULL;
      pd->appContext = app;
*** /tmp/da05851	Wed Dec  9 16:08:29 1992
--- mit/lib/Xt/TMkey.c	Wed Dec  9 16:08:28 1992
***************
*** 1,4 ****
! /* $XConsortium: TMkey.c,v 1.16 92/05/19 11:16:48 converse Exp $ */
  /*LINTLIBRARY*/
  
  /***********************************************************
--- 1,4 ----
! /* $XConsortium: TMkey.c,v 1.17 92/11/23 15:44:37 converse Exp $ */
  /*LINTLIBRARY*/
  
  /***********************************************************
***************
*** 267,272 ****
--- 267,273 ----
      TMKeyContext tm_context = pd->tm_context;
      Modifiers translateModifiers;
  
+     _InitializeKeysymTables(dpy, pd);
      translateModifiers =(Modifiers)
        (eventSeq->event.modifiers & ((ShiftMask|LockMask) | pd->mode_switch));
  
***************
*** 309,315 ****
      FLUSHKEYCACHE(pd->tm_context);
      if (pd->keysyms)
  	XFree( (char *)pd->keysyms );
-     XDisplayKeycodes(dpy, &pd->min_keycode, &pd->max_keycode);
      pd->keysyms_serial = NextRequest(dpy);
      pd->keysyms = XGetKeyboardMapping(dpy, pd->min_keycode,
  				      pd->max_keycode-pd->min_keycode+1,
--- 310,315 ----
*** /tmp/da07940	Thu Dec 10 16:14:07 1992
--- mit/lib/Xt/Xtos.h	Thu Dec 10 16:14:07 1992
***************
*** 1,5 ****
  /*
! * $XConsortium: Xtos.h,v 1.9 90/12/27 14:34:27 rws Exp $
  */
  
  /***********************************************************
--- 1,5 ----
  /*
! * $XConsortium: Xtos.h,v 1.11 91/11/08 17:55:15 gildea Exp $
  */
  
  /***********************************************************
***************
*** 73,79 ****
   * Some System V boxes extract alloca.o from /lib/libPW.a; if you
   * decide that you don't want to use alloca, you might want to fix it here.
   */
! char *alloca();
  #define ALLOCATE_LOCAL(size) alloca((int)(size))
  #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
  #endif /* who does alloca */
--- 73,81 ----
   * Some System V boxes extract alloca.o from /lib/libPW.a; if you
   * decide that you don't want to use alloca, you might want to fix it here.
   */
! /* alloca might be a macro taking one arg (hi, Sun!), so give it one. */
! #define __Xnullarg		/* as nothing */
! char *alloca(__Xnullarg);
  #define ALLOCATE_LOCAL(size) alloca((int)(size))
  #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
  #endif /* who does alloca */
*** /tmp/da07962	Thu Dec 10 16:14:09 1992
--- mit/lib/Xt/Functions.c	Thu Dec 10 16:14:08 1992
***************
*** 1,4 ****
! /* $XConsortium: Functions.c,v 1.5 91/05/03 15:31:31 rws Exp $ */
  
  /*
  
--- 1,4 ----
! /* $XConsortium: Functions.c,v 1.6 92/06/30 10:45:22 rws Exp $ */
  
  /*
  
***************
*** 90,103 ****
  Boolean XtIsVendorShell(object)
      Widget object;
  {
- #if defined(AIXSHLIB) && defined(SHAREDCODE)
      return _XtIsSubclassOf(object,
  			   transientShellWidgetClass->core_class.superclass,
  			   (WidgetClass)wmShellWidgetClass, 0x40);
- #else
-     return _XtIsSubclassOf(object, (WidgetClass)vendorShellWidgetClass,
- 			   (WidgetClass)wmShellWidgetClass, 0x40);
- #endif
  }
  
  
--- 90,105 ----
  Boolean XtIsVendorShell(object)
      Widget object;
  {
      return _XtIsSubclassOf(object,
+ #ifdef notdef
+ /*
+  * We don't refer to vendorShell directly, because some shared libraries
+  * bind local references tightly.
+  */
+ 			   (WidgetClass)vendorShellWidgetClass,
+ #endif
  			   transientShellWidgetClass->core_class.superclass,
  			   (WidgetClass)wmShellWidgetClass, 0x40);
  }
  
  
*** /tmp/da05708	Wed Dec  9 16:02:54 1992
--- mit/lib/Xmu/CrCmap.c	Wed Dec  9 16:02:53 1992
***************
*** 1,4 ****
! /* $XConsortium: CrCmap.c,v 1.3 91/04/10 16:45:46 converse Exp $
   *
   * CreateCmap.c - given a standard colormap description, make the map.
   * 
--- 1,4 ----
! /* $XConsortium: CrCmap.c,v 1.5 92/11/24 14:40:47 rws Exp $
   *
   * CreateCmap.c - given a standard colormap description, make the map.
   * 
***************
*** 39,44 ****
--- 39,49 ----
  static Status	readonly_map();		/* create a map in a RO visual type */
  static Status	readwrite_map();	/* create a map in a RW visual type */
  
+ #define lowbit(x) ((x) & (~(x) + 1))
+ #define TRUEMATCH(mult,max,mask) \
+     (colormap->max * colormap->mult <= vinfo->mask && \
+      lowbit(vinfo->mask) == colormap->mult)
+ 
  /*
   * To create any one colormap which is described by an XStandardColormap
   * structure, use XmuCreateColormap().
***************
*** 121,126 ****
--- 126,135 ----
      if (vinfo->class == PseudoColor || vinfo->class == DirectColor ||
  	vinfo->class == GrayScale)
  	status = readwrite_map(dpy, vinfo, colormap);
+     else if (vinfo->class == TrueColor)
+ 	status = TRUEMATCH(red_mult, red_max, red_mask) &&
+ 	         TRUEMATCH(green_mult, green_max, green_mask) &&
+ 		 TRUEMATCH(blue_mult, blue_max, blue_mask);
      else 
  	status = readonly_map(dpy, vinfo, colormap);
      
***************
*** 134,140 ****
      XVisualInfo		*vinfo;
      XStandardColormap	*colormap;
  {
!     register int	i, n;		/* index counters */
      int			ncolors;	/* number of colors to be defined */
      int			npixels;	/* number of pixels allocated R/W */
      int			first_index;	/* first index of pixels to use */
--- 143,149 ----
      XVisualInfo		*vinfo;
      XStandardColormap	*colormap;
  {
!     register unsigned long i, n;	/* index counters */
      int			ncolors;	/* number of colors to be defined */
      int			npixels;	/* number of pixels allocated R/W */
      int			first_index;	/* first index of pixels to use */
***************
*** 141,154 ****
      int			remainder;	/* first index of remainder */
      XColor		color;		/* the definition of a color */
      unsigned long	*pixels;	/* array of colormap pixels */
  
      
      /* Determine ncolors, the number of colors to be defined.
       * Insure that 1 < ncolors <= the colormap size.
       */
!     ncolors = colormap->red_max * colormap->red_mult +
! 	      colormap->green_max * colormap->green_mult +
! 	      colormap->blue_max * colormap->blue_mult + 1;
      if (ncolors <= 1 || ncolors > vinfo->colormap_size)	return 0;
  
      /* Allocate Read/Write as much of the colormap as we can possibly get.
--- 150,177 ----
      int			remainder;	/* first index of remainder */
      XColor		color;		/* the definition of a color */
      unsigned long	*pixels;	/* array of colormap pixels */
+     unsigned long	delta;
  
      
      /* Determine ncolors, the number of colors to be defined.
       * Insure that 1 < ncolors <= the colormap size.
       */
!     if (vinfo->class == DirectColor) {
! 	ncolors = colormap->red_max;
! 	if (colormap->green_max > ncolors)
! 	    ncolors = colormap->green_max;
! 	if (colormap->blue_max > ncolors)
! 	    ncolors = colormap->blue_max;
! 	ncolors++;
! 	delta = lowbit(vinfo->red_mask) +
! 	        lowbit(vinfo->green_mask) +
! 		lowbit(vinfo->blue_mask);
!     } else {
! 	ncolors = colormap->red_max * colormap->red_mult +
! 		  colormap->green_max * colormap->green_mult +
! 		  colormap->blue_max * colormap->blue_mult + 1;
! 	delta = 1;
!     }
      if (ncolors <= 1 || ncolors > vinfo->colormap_size)	return 0;
  
      /* Allocate Read/Write as much of the colormap as we can possibly get.
***************
*** 181,187 ****
  
      qsort((char *) pixels, npixels, sizeof(unsigned long), compare);
  
!     if (! contiguous(pixels, npixels, ncolors, &first_index, &remainder))
      {
  	/* can't find enough contiguous cells, give up */
  	XFreeColors(dpy, colormap->colormap, pixels, npixels,
--- 204,210 ----
  
      qsort((char *) pixels, npixels, sizeof(unsigned long), compare);
  
!     if (!contiguous(pixels, npixels, ncolors, delta, &first_index, &remainder))
      {
  	/* can't find enough contiguous cells, give up */
  	XFreeColors(dpy, colormap->colormap, pixels, npixels,
***************
*** 194,202 ****
      /* construct a gray map */
      if (colormap->red_mult == 1 && colormap->green_mult == 1 &&
  	colormap->blue_mult == 1)
! 	for (n=colormap->base_pixel, i=0; i < ncolors; i++, n++)
  	{
! 	    color.pixel = (unsigned long) n;
  	    color.blue = color.green = color.red =
  		(unsigned short) ((i * 65535) / (colormap->red_max +
  						 colormap->green_max +
--- 217,225 ----
      /* construct a gray map */
      if (colormap->red_mult == 1 && colormap->green_mult == 1 &&
  	colormap->blue_mult == 1)
! 	for (n=colormap->base_pixel, i=0; i < ncolors; i++, n += delta)
  	{
! 	    color.pixel = n;
  	    color.blue = color.green = color.red =
  		(unsigned short) ((i * 65535) / (colormap->red_max +
  						 colormap->green_max +
***************
*** 203,248 ****
  						 colormap->blue_max));
  
  	    if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
! 			     first_index + i, n))
  		return 0;
  	}
  
      /* construct a red ramp map */
      else if (colormap->green_max == 0 && colormap->blue_max == 0)
!     	for (n=colormap->base_pixel, i=0; i < ncolors; i++, n++)
  	{
! 	    color.pixel = (unsigned long) n;
  	    color.red = (unsigned short) ((i * 65535) / colormap->red_max);
  	    color.green = color.blue = 0;
  
  	    if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
! 			     first_index + i, n))
  		return 0;
  	}
  
      /* construct a green ramp map */
      else if (colormap->red_max == 0 && colormap->blue_max == 0)
!     	for (n=colormap->base_pixel, i=0; i < ncolors; i++, n++)
  	{
! 	    color.pixel = (unsigned long) n;
  	    color.green = (unsigned short) ((i * 65535) / colormap->green_max);
  	    color.red = color.blue = 0;
  
  	    if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
! 			     first_index + i, n))
  		return 0;
  	}
  
      /* construct a blue ramp map */
      else if (colormap->red_max == 0 && colormap->green_max == 0)
!     	for (n=colormap->base_pixel, i=0; i < ncolors; i++, n++)
  	{
! 	    color.pixel = (unsigned long) n;
  	    color.blue = (unsigned short) ((i * 65535) / colormap->blue_max);
  	    color.red = color.green = 0;
  
  	    if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
! 			     first_index + i, n))
  		return 0;
  	}
  
--- 226,271 ----
  						 colormap->blue_max));
  
  	    if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
! 			     first_index + i))
  		return 0;
  	}
  
      /* construct a red ramp map */
      else if (colormap->green_max == 0 && colormap->blue_max == 0)
!     	for (n=colormap->base_pixel, i=0; i < ncolors; i++, n += delta)
  	{
! 	    color.pixel = n;
  	    color.red = (unsigned short) ((i * 65535) / colormap->red_max);
  	    color.green = color.blue = 0;
  
  	    if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
! 			     first_index + i))
  		return 0;
  	}
  
      /* construct a green ramp map */
      else if (colormap->red_max == 0 && colormap->blue_max == 0)
!     	for (n=colormap->base_pixel, i=0; i < ncolors; i++, n += delta)
  	{
! 	    color.pixel = n;
  	    color.green = (unsigned short) ((i * 65535) / colormap->green_max);
  	    color.red = color.blue = 0;
  
  	    if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
! 			     first_index + i))
  		return 0;
  	}
  
      /* construct a blue ramp map */
      else if (colormap->red_max == 0 && colormap->green_max == 0)
!     	for (n=colormap->base_pixel, i=0; i < ncolors; i++, n += delta)
  	{
! 	    color.pixel = n;
  	    color.blue = (unsigned short) ((i * 65535) / colormap->blue_max);
  	    color.red = color.green = 0;
  
  	    if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
! 			     first_index + i))
  		return 0;
  	}
  
***************
*** 249,270 ****
      /* construct a standard red green blue cube map */
      else
      {
! 	int r = colormap->red_mult;
! 	int g = colormap->green_mult;
! 	int gg = colormap->green_max + 1;
  
!     	for (n=colormap->base_pixel, i=0; i < ncolors; i++, n++)
  	{
! 	    color.pixel = (unsigned long) n;
! 	    color.red = (unsigned short) (((i/r) * 65535) / colormap->red_max);
! 	    color.green = (unsigned short) ((((i/g)%gg) * 65535) /
! 					    colormap->green_max);
! 	    color.blue = (unsigned short) (((i%g) * 65535) /
! 					   colormap->blue_max);
  	    if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
! 			     first_index + i, n))
  		return 0;
  	}
      }
      /* We have a read-only map defined.  Now free unused cells,
       * first those occuring before the contiguous sequence begins,
--- 272,291 ----
      /* construct a standard red green blue cube map */
      else
      {
! #define calc(max,mult) (((n / colormap->mult) % \
! 			 (colormap->max + 1)) * 65535) / colormap->max
  
!     	for (n=0, i=0; i < ncolors; i++, n += delta)
  	{
! 	    color.pixel = n + colormap->base_pixel;
! 	    color.red = calc(red_max, red_mult);
! 	    color.green = calc(green_max, green_mult);
! 	    color.blue = calc(blue_max, blue_mult);
  	    if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
! 			     first_index + i))
  		return 0;
  	}
+ #undef calc
      }
      /* We have a read-only map defined.  Now free unused cells,
       * first those occuring before the contiguous sequence begins,
***************
*** 322,331 ****
        
  
  /****************************************************************************/
! static Status contiguous(pixels, npixels, ncolors, first, rem)
      unsigned long	pixels[];	/* specifies allocated pixels */
      int			npixels;	/* specifies count of alloc'd pixels */
      int			ncolors;	/* specifies needed sequence length */
      int			*first;		/* returns first index of sequence */
      int			*rem;		/* returns first index after sequence,
  					 * or 0, if none follow */
--- 343,353 ----
        
  
  /****************************************************************************/
! static Status contiguous(pixels, npixels, ncolors, delta, first, rem)
      unsigned long	pixels[];	/* specifies allocated pixels */
      int			npixels;	/* specifies count of alloc'd pixels */
      int			ncolors;	/* specifies needed sequence length */
+     unsigned long	delta;		/* between pixels */
      int			*first;		/* returns first index of sequence */
      int			*rem;		/* returns first index after sequence,
  					 * or 0, if none follow */
***************
*** 333,343 ****
      register int i = 1;		/* walking index into the pixel array */
      register int count = 1;	/* length of sequence discovered so far */
  
-     *rem = npixels - 1;
      *first = 0;
      while (count < ncolors && ncolors - count <= *rem)
      {
! 	if (pixels[i-1] + 1 == pixels[i])
  	    count++;
  	else {
  	    count = 1;
--- 355,369 ----
      register int i = 1;		/* walking index into the pixel array */
      register int count = 1;	/* length of sequence discovered so far */
  
      *first = 0;
+     if (npixels == ncolors) {
+ 	*rem = 0;
+ 	return 1;
+     }
+     *rem = npixels - 1;
      while (count < ncolors && ncolors - count <= *rem)
      {
! 	if (pixels[i-1] + delta == pixels[i])
  	    count++;
  	else {
  	    count = 1;
***************
*** 353,366 ****
  
  
  /****************************************************************************/
! static Status ROorRWcell(dpy, cmap, pixels, npixels, color, p, n)
      Display		*dpy;
      Colormap		cmap;
      unsigned long	pixels[];
      int			npixels;
      XColor		*color;
!     int			p;
!     int			n;
  {
      unsigned long	pixel;
      XColor		request;
--- 379,391 ----
  
  
  /****************************************************************************/
! static Status ROorRWcell(dpy, cmap, pixels, npixels, color, p)
      Display		*dpy;
      Colormap		cmap;
      unsigned long	pixels[];
      int			npixels;
      XColor		*color;
!     unsigned long	p;
  {
      unsigned long	pixel;
      XColor		request;
***************
*** 377,383 ****
       * because we want contiguous cells for image processing algorithms.
       */
       
!     pixel = (unsigned long) n;
      request.red = color->red;
      request.green = color->green;
      request.blue = color->blue;
--- 402,408 ----
       * because we want contiguous cells for image processing algorithms.
       */
       
!     pixel = color->pixel;
      request.red = color->red;
      request.green = color->green;
      request.blue = color->blue;
***************
*** 385,393 ****
      XFreeColors(dpy, cmap, &pixel, 1, (unsigned long) 0);
      if (! XAllocColor(dpy, cmap, color) 
  	|| (color->pixel != pixel &&
! 	    (!RWcell(dpy, cmap, color, &request, &pixel, n)))) 
      {
! 	free_cells(dpy, cmap, pixels, npixels, p);
  	return 0;
      }
      return 1;
--- 410,418 ----
      XFreeColors(dpy, cmap, &pixel, 1, (unsigned long) 0);
      if (! XAllocColor(dpy, cmap, color) 
  	|| (color->pixel != pixel &&
! 	    (!RWcell(dpy, cmap, color, &request, &pixel)))) 
      {
! 	free_cells(dpy, cmap, pixels, npixels, (int)p);
  	return 0;
      }
      return 1;
***************
*** 414,427 ****
  
  
  /****************************************************************************/
! static Status RWcell(dpy, cmap, color, request, pixel, n)
      Display		*dpy;
      Colormap		cmap;
      XColor		*color;
      XColor		*request;
      unsigned long	*pixel;
-     int			n;
  {
      XFreeColors(dpy, cmap, &(color->pixel), 1, (unsigned long)0);
      if (! XAllocColorCells(dpy, cmap, (Bool) 0, (unsigned long *) NULL,
  			   (unsigned) 0, pixel, (unsigned) 1))
--- 439,453 ----
  
  
  /****************************************************************************/
! static Status RWcell(dpy, cmap, color, request, pixel)
      Display		*dpy;
      Colormap		cmap;
      XColor		*color;
      XColor		*request;
      unsigned long	*pixel;
  {
+     unsigned long	n = *pixel;
+ 
      XFreeColors(dpy, cmap, &(color->pixel), 1, (unsigned long)0);
      if (! XAllocColorCells(dpy, cmap, (Bool) 0, (unsigned long *) NULL,
  			   (unsigned) 0, pixel, (unsigned) 1))
***************
*** 469,475 ****
  	color.red = (unsigned short)
  	    (((i/colormap->red_mult) * 65535) / colormap->red_max);
  
! 	if (vinfo->class == StaticColor || vinfo->class == TrueColor) {
  	    color.green = (unsigned short)
  		((((i/colormap->green_mult) % (colormap->green_max + 1)) *
  		  65535) / colormap->green_max);
--- 495,501 ----
  	color.red = (unsigned short)
  	    (((i/colormap->red_mult) * 65535) / colormap->red_max);
  
! 	if (vinfo->class == StaticColor) {
  	    color.green = (unsigned short)
  		((((i/colormap->green_mult) % (colormap->green_max + 1)) *
  		  65535) / colormap->green_max);
*** /tmp/da05730	Wed Dec  9 16:02:56 1992
--- mit/lib/Xmu/CmapAlloc.c	Wed Dec  9 16:02:55 1992
***************
*** 1,5 ****
  /*
!  * $XConsortium: CmapAlloc.c,v 1.4 91/07/19 16:36:50 gildea Exp $
   * 
   * Copyright 1989 by the Massachusetts Institute of Technology
   *
--- 1,5 ----
  /*
!  * $XConsortium: CmapAlloc.c,v 1.7 92/11/24 14:15:51 rws Exp $
   * 
   * Copyright 1989 by the Massachusetts Institute of Technology
   *
***************
*** 28,33 ****
--- 28,35 ----
  #include <X11/Xutil.h>
  #include <stdio.h>
  
+ #define lowbit(x) ((x) & (~(x) + 1))
+ 
  static int default_allocation();
  static void best_allocation();
  static void gray_allocation();
***************
*** 107,114 ****
   * If a map has less than a minimum number of definable entries, we do not
   * produce an allocation for an RGB_DEFAULT_MAP.  
   *
!  * For 24 planes, the default colormap will have 64 reds, 64 greens, and 64
!  * blues.  For 8 planes, let n = the number of colormap entries, which may
   * be 256 or 254.  Then, maximum red value = floor(cube_root(n - 125)) - 1.
   * Maximum green and maximum blue values are identical to maximum red.
   * This leaves at least 125 cells which clients can allocate.
--- 109,116 ----
   * If a map has less than a minimum number of definable entries, we do not
   * produce an allocation for an RGB_DEFAULT_MAP.  
   *
!  * For 16 planes, the default colormap will have 27 each RGB; for 12 planes,
!  * 12 each.  For 8 planes, let n = the number of colormap entries, which may
   * be 256 or 254.  Then, maximum red value = floor(cube_root(n - 125)) - 1.
   * Maximum green and maximum blue values are identical to maximum red.
   * This leaves at least 125 cells which clients can allocate.
***************
*** 127,137 ****
  
      switch (vinfo->class) {
        case PseudoColor:
-       case DirectColor:
  
! 	if (vinfo->colormap_size > 500000)
! 	    /* intended for displays with 24 planes */
! 	    *red = *green = *blue = (unsigned long) 63;
  	else if (vinfo->colormap_size > 4000)
  	    /* intended for displays with 12 planes */
  	    *red = *green = *blue = (unsigned long) 12;
--- 129,138 ----
  
      switch (vinfo->class) {
        case PseudoColor:
  
! 	if (vinfo->colormap_size > 65000)
! 	    /* intended for displays with 16 planes */
! 	    *red = *green = *blue = (unsigned long) 27;
  	else if (vinfo->colormap_size > 4000)
  	    /* intended for displays with 12 planes */
  	    *red = *green = *blue = (unsigned long) 12;
***************
*** 141,149 ****
  		(icbrt(vinfo->colormap_size - 125) - 1);
  	break;
  
        case GrayScale:
  
! 	if (vinfo->colormap_size > 5000000)
  	    ngrays = 4096;
  	else if (vinfo->colormap_size > 4000)
  	    ngrays = 512;
--- 142,162 ----
  		(icbrt(vinfo->colormap_size - 125) - 1);
  	break;
  
+       case DirectColor:
+ 
+ 	*red = *green = *blue = vinfo->colormap_size / 2 - 1;
+ 	break;
+ 
+       case TrueColor:
+ 
+ 	*red = vinfo->red_mask / lowbit(vinfo->red_mask);
+ 	*green = vinfo->green_mask / lowbit(vinfo->green_mask);
+ 	*blue = vinfo->blue_mask / lowbit(vinfo->blue_mask);
+ 	break;
+ 
        case GrayScale:
  
! 	if (vinfo->colormap_size > 65000)
  	    ngrays = 4096;
  	else if (vinfo->colormap_size > 4000)
  	    ngrays = 512;
*** /tmp/da05752	Wed Dec  9 16:02:58 1992
--- mit/lib/Xmu/LookupCmap.c	Wed Dec  9 16:02:58 1992
***************
*** 1,4 ****
! /* $XConsortium: LookupCmap.c,v 1.7 89/10/08 15:00:44 rws Exp $ 
   * 
   * Copyright 1989 by the Massachusetts Institute of Technology
   *
--- 1,4 ----
! /* $XConsortium: LookupCmap.c,v 1.8 92/11/23 15:43:44 rws Exp $ 
   * 
   * Copyright 1989 by the Massachusetts Institute of Technology
   *
***************
*** 114,120 ****
  	return 0;
      }
  
!     cmap = (property == XA_RGB_DEFAULT_MAP)
  	? DefaultColormap(dpy, screen) : None;
  
      /* If retaining resources, open a new connection to the same server */
--- 114,121 ----
  	return 0;
      }
  
!     cmap = (property == XA_RGB_DEFAULT_MAP &&
! 	    visualid == XVisualIDFromVisual(DefaultVisual(dpy, screen)))
  	? DefaultColormap(dpy, screen) : None;
  
      /* If retaining resources, open a new connection to the same server */
*** /tmp/da05774	Wed Dec  9 16:03:00 1992
--- mit/lib/Xmu/StdCmap.c	Wed Dec  9 16:03:00 1992
***************
*** 1,4 ****
! /* $XConsortium: StdCmap.c,v 1.11 89/10/08 15:04:52 rws Exp $ 
   * 
   * Copyright 1989 by the Massachusetts Institute of Technology
   *
--- 1,4 ----
! /* $XConsortium: StdCmap.c,v 1.13 92/11/24 14:16:21 rws Exp $ 
   * 
   * Copyright 1989 by the Massachusetts Institute of Technology
   *
***************
*** 28,33 ****
--- 28,35 ----
  #include <X11/Xutil.h>
  #include <X11/Xmu/StdCmap.h>
  
+ #define lowbit(x) ((x) & (~(x) + 1))
+ 
  static Status valid_args();		/* argument restrictions */
  
  /*
***************
*** 101,107 ****
      stdcmap->blue_max = blue_max;
      if (property == XA_RGB_GRAY_MAP) 
  	stdcmap->red_mult = stdcmap->green_mult = stdcmap->blue_mult = 1;
!     else {
  	stdcmap->red_mult = (red_max > 0)
  	    ? (green_max + 1) * (blue_max + 1) : 0;
  	stdcmap->green_mult = (green_max > 0) ? blue_max + 1 : 0;
--- 103,113 ----
      stdcmap->blue_max = blue_max;
      if (property == XA_RGB_GRAY_MAP) 
  	stdcmap->red_mult = stdcmap->green_mult = stdcmap->blue_mult = 1;
!     else if (vinfo->class == TrueColor || vinfo->class == DirectColor) {
! 	stdcmap->red_mult = lowbit(vinfo->red_mask);
! 	stdcmap->green_mult = lowbit(vinfo->green_mask);
! 	stdcmap->blue_mult = lowbit(vinfo->blue_mask);
!     } else {
  	stdcmap->red_mult = (red_max > 0)
  	    ? (green_max + 1) * (blue_max + 1) : 0;
  	stdcmap->green_mult = (green_max > 0) ? blue_max + 1 : 0;
***************
*** 174,207 ****
      switch (property)
      {
        case XA_RGB_DEFAULT_MAP:
! 	if ((red_max == 0 || green_max == 0 || blue_max == 0) ||
! 	    (vinfo->class != PseudoColor && vinfo->class != DirectColor &&
! 	     vinfo->class != GrayScale))
  	    return 0;
  	break;
        case XA_RGB_RED_MAP:
! 	if ((vinfo->class != PseudoColor && vinfo->class != DirectColor) ||
! 	    (red_max == 0))
  	    return 0;
  	break;
        case XA_RGB_GREEN_MAP:
! 	if ((vinfo->class != PseudoColor && vinfo->class != DirectColor) ||
! 	    (green_max == 0))
  	    return 0;
  	break;
        case XA_RGB_BLUE_MAP:	
! 	if ((vinfo->class != PseudoColor && vinfo->class != DirectColor) ||
! 	    blue_max == 0)
  	    return 0;
  	break;
        case XA_RGB_BEST_MAP:
! 	if (vinfo->class == GrayScale || vinfo->class == StaticGray ||
! 	    red_max == 0 || green_max == 0 || blue_max == 0)
  	    return 0;
  	break;
        case XA_RGB_GRAY_MAP:
! 	if (vinfo->class == StaticColor || vinfo->class == TrueColor ||
! 	    red_max == 0 || blue_max == 0 || green_max == 0)
  	    return 0;
  	break;
        default:
--- 180,206 ----
      switch (property)
      {
        case XA_RGB_DEFAULT_MAP:
! 	if (red_max == 0 || green_max == 0 || blue_max == 0)
  	    return 0;
  	break;
        case XA_RGB_RED_MAP:
! 	if (red_max == 0)
  	    return 0;
  	break;
        case XA_RGB_GREEN_MAP:
! 	if (green_max == 0)
  	    return 0;
  	break;
        case XA_RGB_BLUE_MAP:	
! 	if (blue_max == 0)
  	    return 0;
  	break;
        case XA_RGB_BEST_MAP:
! 	if (red_max == 0 || green_max == 0 || blue_max == 0)
  	    return 0;
  	break;
        case XA_RGB_GRAY_MAP:
! 	if (red_max == 0 || blue_max == 0 || green_max == 0)
  	    return 0;
  	break;
        default:
*** /tmp/da06077	Mon Nov 23 18:19:24 1992
--- mit/lib/Xaw/SimpleMenu.c	Mon Nov 23 18:19:23 1992
***************
*** 1,4 ****
! /* $XConsortium: SimpleMenu.c,v 1.39 91/06/22 18:03:29 rws Exp $ */
  
  /*
   * Copyright 1989 Massachusetts Institute of Technology
--- 1,4 ----
! /* $XConsortium: SimpleMenu.c,v 1.41 92/09/10 16:25:07 converse Exp $ */
  
  /*
   * Copyright 1989 Massachusetts Institute of Technology
***************
*** 241,248 ****
  
  /* ARGSUSED */
  static void
! Initialize(request, new)
  Widget request, new;
  {
    SimpleMenuWidget smw = (SimpleMenuWidget) new;
  
--- 241,250 ----
  
  /* ARGSUSED */
  static void
! Initialize(request, new, args, num_args)
  Widget request, new;
+ ArgList args;
+ Cardinal *num_args;
  {
    SimpleMenuWidget smw = (SimpleMenuWidget) new;
  
***************
*** 388,395 ****
  
  /* ARGSUSED */
  static Boolean
! SetValues(current, request, new)
  Widget current, request, new;
  {
      SimpleMenuWidget smw_old = (SimpleMenuWidget) current;
      SimpleMenuWidget smw_new = (SimpleMenuWidget) new;
--- 390,399 ----
  
  /* ARGSUSED */
  static Boolean
! SetValues(current, request, new, args, num_args)
  Widget current, request, new;
+ ArgList args;
+ Cardinal *num_args;
  {
      SimpleMenuWidget smw_old = (SimpleMenuWidget) current;
      SimpleMenuWidget smw_new = (SimpleMenuWidget) new;
***************
*** 418,427 ****
  	else if (smw_old->simple_menu.label_string == NULL)    /* Create. */
  	    CreateLabel(new);
  	else {                                                 /* Change. */
! 	    Arg args[1];
  	    
! 	    XtSetArg(args[0], XtNlabel, smw_new->simple_menu.label_string);
! 	    XtSetValues((Widget) smw_new->simple_menu.label, args, ONE);
  	}
      
      if (smw_old->simple_menu.label_class != smw_new->simple_menu.label_class)
--- 422,431 ----
  	else if (smw_old->simple_menu.label_string == NULL)    /* Create. */
  	    CreateLabel(new);
  	else {                                                 /* Change. */
! 	    Arg arglist[1];
  	    
! 	    XtSetArg(arglist[0], XtNlabel, smw_new->simple_menu.label_string);
! 	    XtSetValues((Widget) smw_new->simple_menu.label, arglist, ONE);
  	}
      
      if (smw_old->simple_menu.label_class != smw_new->simple_menu.label_class)
***************
*** 1197,1207 ****
  
      height = smw->simple_menu.top_margin + smw->simple_menu.bottom_margin;
      
!     if (smw->simple_menu.row_height == 0) 
  	ForAllChildren(smw, entry) 
  	    if (XtIsManaged ((Widget) *entry)) 
  		height += (*entry)->rectangle.height;
!     else 
  	height += smw->simple_menu.row_height * smw->composite.num_children;
  	
      return(height);
--- 1201,1211 ----
  
      height = smw->simple_menu.top_margin + smw->simple_menu.bottom_margin;
      
!     if (smw->simple_menu.row_height == 0) {
  	ForAllChildren(smw, entry) 
  	    if (XtIsManaged ((Widget) *entry)) 
  		height += (*entry)->rectangle.height;
!     } else 
  	height += smw->simple_menu.row_height * smw->composite.num_children;
  	
      return(height);
*** /tmp/da06099	Mon Nov 23 18:19:27 1992
--- mit/lib/Xaw/Text.c	Mon Nov 23 18:19:26 1992
***************
*** 1,4 ****
! /* $XConsortium: Text.c,v 1.182 91/07/24 22:56:47 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Text.c,v 1.184 92/11/16 15:00:13 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 1754,1760 ****
    Widget src = ctx->text.source;
    XawTextEditType edit_mode;
    Arg args[1];
!   
    ctx->text.update_disabled = True; /* No redisplay during replacement. */
  
  /*
--- 1754,1761 ----
    Widget src = ctx->text.source;
    XawTextEditType edit_mode;
    Arg args[1];
!   Boolean tmp = ctx->text.update_disabled;
! 
    ctx->text.update_disabled = True; /* No redisplay during replacement. */
  
  /*
***************
*** 1770,1787 ****
  		   (ctx->text.insertPos - pos1), TRUE);
      pos1 = ctx->text.insertPos;
      if ( (pos1 == pos2) && (text->length == 0) ) {
!       ctx->text.update_disabled = FALSE; /* rearm redisplay. */
        return( XawEditError );
      }
    }
  
!   updateFrom = SrcScan(src, pos1, XawstWhiteSpace, XawsdLeft, 1, TRUE);
!   updateFrom = SrcScan(src, updateFrom, XawstPositions, XawsdLeft, 1, TRUE);
    updateFrom = Max(updateFrom, ctx->text.lt.top);
  
    line1 = LineForPosition(ctx, updateFrom);
    if ( (error = SrcReplace(src, pos1, pos2, text)) != 0) {
!     ctx->text.update_disabled = FALSE; /* rearm redisplay. */
      return(error);
    }
  
--- 1771,1787 ----
  		   (ctx->text.insertPos - pos1), TRUE);
      pos1 = ctx->text.insertPos;
      if ( (pos1 == pos2) && (text->length == 0) ) {
!       ctx->text.update_disabled = tmp; /* restore redisplay */
        return( XawEditError );
      }
    }
  
!   updateFrom = SrcScan(src, pos1, XawstWhiteSpace, XawsdLeft, 1, FALSE);
    updateFrom = Max(updateFrom, ctx->text.lt.top);
  
    line1 = LineForPosition(ctx, updateFrom);
    if ( (error = SrcReplace(src, pos1, pos2, text)) != 0) {
!     ctx->text.update_disabled = tmp; /* restore redisplay */
      return(error);
    }
  
***************
*** 1791,1797 ****
    if (ctx->text.lt.top >= ctx->text.lastPos) {
      _XawTextBuildLineTable(ctx, ctx->text.lastPos, FALSE);
      ClearWindow( (Widget) ctx);
!     ctx->text.update_disabled = FALSE; /* rearm redisplay. */
      return(0);			/* Things are fine. */
    }
  
--- 1791,1797 ----
    if (ctx->text.lt.top >= ctx->text.lastPos) {
      _XawTextBuildLineTable(ctx, ctx->text.lastPos, FALSE);
      ClearWindow( (Widget) ctx);
!     ctx->text.update_disabled = tmp; /* restore redisplay */
      return(0);			/* Things are fine. */
    }
  
***************
*** 1832,1838 ****
      _XawTextNeedsUpdating(ctx, updateFrom, updateTo);
    }
  
!   ctx->text.update_disabled = FALSE; /* rearm redisplay. */
    return(0);			/* Things are fine. */
  }
  
--- 1832,1838 ----
      _XawTextNeedsUpdating(ctx, updateFrom, updateTo);
    }
  
!   ctx->text.update_disabled = tmp; /* restore redisplay */
    return(0);			/* Things are fine. */
  }
  
*** /tmp/da06121	Mon Nov 23 18:19:30 1992
--- mit/fonts/lib/font/fc/fsconvert.c	Mon Nov 23 18:19:29 1992
***************
*** 1,17 ****
! /* $XConsortium: fsconvert.c,v 1.9 92/05/12 18:07:31 gildea Exp $ */
  /*
   * Copyright 1990 Network Computing Devices
   *
!  * Permission to use, copy, modify, distribute, and sell this software and its
!  * documentation for any purpose is hereby granted without fee, provided that
!  * the above copyright notice appear in all copies and that both that
   * copyright notice and this permission notice appear in supporting
!  * documentation, and that the name of Network Computing Devices not be
!  * used in advertising or publicity pertaining to distribution of the
!  * software without specific, written prior permission.  Network Computing
!  * Devices makes no representations about the suitability of this software
!  * for any purpose.  It is provided "as is" without express or implied
!  * warranty.
   *
   * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
   * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
--- 1,16 ----
! /* $XConsortium: fsconvert.c,v 1.12 92/10/08 17:20:02 gildea Exp $ */
  /*
   * Copyright 1990 Network Computing Devices
   *
!  * Permission to use, copy, modify, distribute, and sell this software and
!  * its documentation for any purpose is hereby granted without fee, provided
!  * that the above copyright notice appear in all copies and that both that
   * copyright notice and this permission notice appear in supporting
!  * documentation, and that the name of Network Computing Devices not be used
!  * in advertising or publicity pertaining to distribution of the software
!  * without specific, written prior permission.  Network Computing Devices
!  * makes no representations about the suitability of this software for any
!  * purpose.  It is provided "as is" without express or implied warranty.
   *
   * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
   * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
***************
*** 59,66 ****
      fsFontHeader *hdr;
      FontInfoPtr pfi;
  {
-     Bool    terminal;
- 
      pfi->allExist = (hdr->flags & FontInfoAllCharsExist) != 0;
      pfi->drawDirection = (hdr->draw_direction == LeftToRightDrawDirection) ?
  	LeftToRight : RightToLeft;
--- 58,63 ----
***************
*** 357,367 ****
      FSFontPtr   fsfont;
      int         i;
      CharInfoPtr encoding;
      
      fsfont = (FSFontPtr) pFont->fontPrivate;
-     if (!fsfont->pDefault)
- 	fsfont->pDefault = &junkDefault;
  
      /* sleeze - smash the encoding so we get ink metrics */
      encoding = fsfont->encoding;
      fsfont->encoding = fsfont->inkMetrics;
--- 354,366 ----
      FSFontPtr   fsfont;
      int         i;
      CharInfoPtr encoding;
+     CharInfoPtr oldDefault;
      
      fsfont = (FSFontPtr) pFont->fontPrivate;
  
+     oldDefault = fsfont->pDefault;
+     fsfont->pDefault = &junkDefault;
+ 
      /* sleeze - smash the encoding so we get ink metrics */
      encoding = fsfont->encoding;
      fsfont->encoding = fsfont->inkMetrics;
***************
*** 369,384 ****
  			 glyphCount, (CharInfoPtr *) glyphs);
      fsfont->encoding = encoding;
  
!     if (ret == Successful) {
! 	if (fsfont->pDefault == &junkDefault) {
! 	    for (i = 0; i < *glyphCount; i++) {
! 		if (glyphs[i] == (xCharInfo *) & junkDefault)
! 		    glyphs[i] = 0;
! 	    }
! 	}
!     }
!     if (fsfont->pDefault == &junkDefault)
! 	fsfont->pDefault = 0;
      return ret;
  }
  
--- 368,374 ----
  			 glyphCount, (CharInfoPtr *) glyphs);
      fsfont->encoding = encoding;
  
!     fsfont->pDefault = oldDefault;
      return ret;
  }
  
*** /tmp/da08055	Thu Dec 10 16:36:25 1992
--- mit/clients/xdm/session.c	Thu Dec 10 16:36:24 1992
***************
*** 1,7 ****
  /*
   * xdm - display manager daemon
   *
!  * $XConsortium: session.c,v 1.55 91/09/19 16:25:56 keith Exp $
   *
   * Copyright 1988 Massachusetts Institute of Technology
   *
--- 1,7 ----
  /*
   * xdm - display manager daemon
   *
!  * $XConsortium: session.c,v 1.58 92/08/14 12:04:59 eswu Exp $
   *
   * Copyright 1988 Massachusetts Institute of Technology
   *
***************
*** 29,34 ****
--- 29,37 ----
  # include <errno.h>
  # include <stdio.h>
  # include <ctype.h>
+ #ifdef AIXV3
+ # include <usersec.h>
+ #endif
  #ifdef SECURE_RPC
  # include <rpc/rpc.h>
  # include <rpc/key_prot.h>
***************
*** 35,41 ****
--- 38,47 ----
  #endif
  
  extern int  errno;
+ extern char **setEnv();
  
+ static Bool StartClient();
+ 
  static int			clientPid;
  static struct greet_info	greet;
  static struct verify_info	verify;
***************
*** 186,192 ****
  	 * Start the clients, changing uid/groups
  	 *	   setting up environment and running the session
  	 */
! 	if (StartClient (&verify, d, &clientPid, greet.password)) {
  	    Debug ("Client Started\n");
  	    /*
  	     * Wait for session to end,
--- 192,198 ----
  	 * Start the clients, changing uid/groups
  	 *	   setting up environment and running the session
  	 */
! 	if (StartClient (&verify, d, &clientPid, greet.name, greet.password)) {
  	    Debug ("Client Started\n");
  	    /*
  	     * Wait for session to end,
***************
*** 357,367 ****
      exit (status);
  }
  
! StartClient (verify, d, pidp, passwd)
! struct verify_info	*verify;
! struct display		*d;
! int			*pidp;
! char			*passwd;
  {
      char	**f, *home, *getEnv ();
      char	*failsafeArgv[2];
--- 363,375 ----
      exit (status);
  }
  
! static Bool
! StartClient (verify, d, pidp, name, passwd)
!     struct verify_info	*verify;
!     struct display	*d;
!     int			*pidp;
!     char		*name;
!     char		*passwd;
  {
      char	**f, *home, *getEnv ();
      char	*failsafeArgv[2];
***************
*** 381,388 ****
      switch (pid = fork ()) {
      case 0:
  	CleanUpChild ();
- #ifdef NGROUPS_MAX
  
  	setgid (verify->groups[0]);
  	setgroups (verify->ngroups, verify->groups);
  #else
--- 389,409 ----
      switch (pid = fork ()) {
      case 0:
  	CleanUpChild ();
  
+ 	/* Do system-dependent login setup here */
+ 
+ #ifdef AIXV3
+ 	/*
+ 	 * Set the user's credentials: uid, gid, groups,
+ 	 * audit classes, user limits, and umask.
+ 	 */
+ 	if (setpcred(name, NULL) == -1)
+ 	{
+ 	    LogError("can't start session, setpcred failed, errno=%d\n", errno);
+ 	    return (0);
+ 	}
+ #else /* AIXV3 */
+ #ifdef NGROUPS_MAX
  	setgid (verify->groups[0]);
  	setgroups (verify->ngroups, verify->groups);
  #else
***************
*** 389,394 ****
--- 410,417 ----
  	setgid (verify->gid);
  #endif
  	setuid (verify->uid);
+ #endif /* AIXV3 */
+ 
  #ifdef SECURE_RPC
  	{
  	    char    netname[MAXNETNAMELEN+1], secretkey[HEXKEYBYTES+1];
***************
*** 411,421 ****
  	SetUserAuthorization (d, verify);
  	home = getEnv (verify->userEnviron, "HOME");
  	if (home)
! 		if (chdir (home) == -1) {
! 			LogError ("No home directory %s for user %s, using /\n",
! 				  home, getEnv (verify->userEnviron, "USER"));
! 			chdir ("/");
! 		}
  	if (verify->argv) {
  		Debug ("executing session %s\n", verify->argv[0]);
  		execute (verify->argv, verify->userEnviron);
--- 434,445 ----
  	SetUserAuthorization (d, verify);
  	home = getEnv (verify->userEnviron, "HOME");
  	if (home)
! 	    if (chdir (home) == -1) {
! 		LogError ("user \"%s\": no home directory \"%s\", using \"/\"\n",
! 			  getEnv (verify->userEnviron, "USER"), home);
! 		chdir ("/");
! 		verify->userEnviron = setEnv(verify->userEnviron, "HOME", "/");
! 	    }
  	if (verify->argv) {
  		Debug ("executing session %s\n", verify->argv[0]);
  		execute (verify->argv, verify->userEnviron);
***************
*** 430,436 ****
      case -1:
  	bzero(passwd, strlen(passwd));
  	Debug ("StartSession, fork failed\n");
! 	LogError ("can't start session for %d, fork failed\n", d->name);
  	return 0;
      default:
  	bzero(passwd, strlen(passwd));
--- 454,461 ----
      case -1:
  	bzero(passwd, strlen(passwd));
  	Debug ("StartSession, fork failed\n");
! 	LogError ("can't start session for %d, fork failed, errno=%d\n",
! 		  d->name, errno);
  	return 0;
      default:
  	bzero(passwd, strlen(passwd));
***************
*** 545,550 ****
--- 570,578 ----
  char	**argv;
  char	**environ;
  {
+     /* give /dev/null as stdin */
+     (void) close (0);
+     open ("/dev/null", 0);
      /* make stdout follow stderr to the log file */
      dup2 (2,1);
      execve (argv[0], argv, environ);
*** /tmp/da06165	Mon Nov 23 18:19:35 1992
--- mit/clients/xdm/config/Xsession	Mon Nov 23 18:19:34 1992
***************
*** 1,6 ****
  #!/bin/sh
  
! exec > $HOME/.xsession-errors 2>&1
  
  case $# in
  1)
--- 1,16 ----
  #!/bin/sh
+ # $XConsortium: Xsession,v 1.7 92/08/06 11:08:14 gildea Exp $
  
! # redirect errors to a file in user's home directory if we can
! for errfile in "$HOME/.xsession-errors" "/tmp/xses-$USER"
! do
! 	if ( cp /dev/null "$errfile" 2> /dev/null )
! 	then
! 		chmod 600 "$errfile"
! 		exec > "$errfile" 2>&1
! 		break
! 	fi
! done
  
  case $# in
  1)
*** /tmp/,RCSt1a06226	Mon Nov 23 18:23:07 1992
--- mit/extensions/lib/PEXlib/Imakefile	Mon Nov 23 18:19:36 1992
***************
*** 1,4 ****
! XCOMM $XConsortium: Imakefile,v 1.8.1.1 92/11/11 10:15:31 rws Exp $
  XCOMM
  XCOMM Copyright 1992 by the Massachusetts Institute of Technology
  XCOMM 
--- 1,4 ----
! XCOMM $XConsortium: Imakefile,v 1.8.1.2 92/11/23 18:21:13 gildea Exp $
  XCOMM
  XCOMM Copyright 1992 by the Massachusetts Institute of Technology
  XCOMM 
***************
*** 89,95 ****
  #else
  SharedLibraryTarget(PEX5,$(SOPEXREV),$(OBJS),.,.)
  #endif
! InstallSharedLibrary(PEX5,$(SOPEXREV),$(LIBDIR))
  #endif
  #if DoNormalLib
  NormalLibraryTarget(PEX5,$(OBJS))
--- 89,95 ----
  #else
  SharedLibraryTarget(PEX5,$(SOPEXREV),$(OBJS),.,.)
  #endif
! InstallSharedLibrary(PEX5,$(SOPEXREV),$(USRLIBDIR))
  #endif
  #if DoNormalLib
  NormalLibraryTarget(PEX5,$(OBJS))
*** /tmp/da06209	Mon Nov 23 18:19:38 1992
--- mit/extensions/lib/PEXlib/pl_font.c	Mon Nov 23 18:19:38 1992
***************
*** 1,4 ****
! /* $XConsortium: pl_font.c,v 1.6 92/09/09 14:07:35 mor Exp $ */
  
  /******************************************************************************
  Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
--- 1,4 ----
! /* $XConsortium: pl_font.c,v 1.7 92/11/23 16:58:54 mor Exp $ */
  
  /******************************************************************************
  Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
***************
*** 479,484 ****
--- 479,485 ----
  	textExtent->upper_right = *(PEXCoord2D *) ch;
  	ch += sizeof (PEXCoord2D);
  	textExtent->concat_point = *(PEXCoord2D *) ch;
+ 	ch += sizeof (PEXCoord2D);
      }
  
  
***************
*** 546,557 ****
       * Update the request length header.
       */
  
!     req->length += count * (LENOF (CARD32) + LENOF (pexMonoEncoding));
      for (i = 0; i < count; i++)
      {
  	string = encoded_text[i].encoded_text;
  	for (j = 0; j < (int) encoded_text[i].count; j++, string++)
  	{
  	    if (string->character_set_width == PEXCSLong) 
  		req->length += string->length;
  	    else if (string->character_set_width == PEXCSShort) 
--- 547,559 ----
       * Update the request length header.
       */
  
!     req->length += (count * LENOF (CARD32));
      for (i = 0; i < count; i++)
      {
  	string = encoded_text[i].encoded_text;
  	for (j = 0; j < (int) encoded_text[i].count; j++, string++)
  	{
+ 	    req->length += LENOF (pexMonoEncoding);
  	    if (string->character_set_width == PEXCSLong) 
  		req->length += string->length;
  	    else if (string->character_set_width == PEXCSShort) 
***************
*** 568,580 ****
  
      for (i = 0; i < count; i++)
      {
  	string = encoded_text[i].encoded_text;
  
! 	Data (display, (char *) &encoded_text[i].count, sizeof (CARD32));
! 	Data (display, (char *) string, sizeof (pexMonoEncoding));
  
! 	for (j = 0; j < (int) encoded_text[i].count; j++, string++)
  	{
  	    if (string->character_set_width == PEXCSLong) 
  	    {
  		Data (display, string->ch, string->length * sizeof (long));
--- 570,584 ----
  
      for (i = 0; i < count; i++)
      {
+ 	unsigned long numEncodings = encoded_text[i].count;
  	string = encoded_text[i].encoded_text;
  
! 	Data (display, (char *) &numEncodings, sizeof (CARD32));
  
! 	for (j = 0; j < (int) numEncodings; j++, string++)
  	{
+ 	    Data (display, (char *) string, sizeof (pexMonoEncoding));
+ 
  	    if (string->character_set_width == PEXCSLong) 
  	    {
  		Data (display, string->ch, string->length * sizeof (long));
***************
*** 626,631 ****
--- 630,636 ----
  	textExtent->upper_right = *(PEXCoord2D *) ch;
  	ch += sizeof (PEXCoord2D);
  	textExtent->concat_point = *(PEXCoord2D *) ch;
+ 	ch += sizeof (PEXCoord2D);
      }
  
  
