diff -c /afs/ir/src/X11R5/mit/clients/xwud/xwud.c xwud/xwud.c
*** /afs/ir/src/X11R5/mit/clients/xwud/xwud.c	Thu Jul 25 15:02:59 1991
--- xwud/xwud.c	Wed Apr  6 09:56:18 1994
***************
*** 15,20 ****
--- 15,28 ----
  
  /* xwud - marginally useful raster image undumper */
  
+ #if defined(__alpha)
+ /* 4/5/94 Achille Hui,
+  *	  patches for alpha in reading XWDColor stuctures instead of
+  *	  XColor structures. You MUST install the corresponding patches
+  *	  of xwd in order for this to work.
+  */
+ #define XLIB_ILLEGAL_ACCESS
+ #endif
  
  #include <X11/Xos.h>
  #include <X11/Xlib.h>
***************
*** 36,44 ****
  
  usage()
  {
!     fprintf(stderr, "usage: %s [-in <file>] [-noclick] [-geometry <geom>] [-display <display>]\n", progname);
!     fprintf(stderr, "            [-new] [-std <maptype>] [-raw] [-vis <vis-type-or-id>]\n");
!     fprintf(stderr, "            [-help] [-rv] [-plane <number>] [-fg <color>] [-bg <color>]\n");
      exit(1);
  }
  
--- 44,52 ----
  
  usage()
  {
!     fprintf(stderr,"usage: %s [-in <file>] [-noclick] [-geometry <geom>] [-display <display>]\n",progname);
!     fprintf(stderr,"       [-new] [-kludge] [-std <maptype>] [-raw] [-vis <vis-type-or-id>]\n");
!     fprintf(stderr,"       [-help] [-rv] [-plane <number>] [-fg <color>] [-bg <color>]\n");
      exit(1);
  }
  
***************
*** 59,65 ****
--- 67,99 ----
      }
      return True;
  }
+ Bool
+ Read_XColors(XColor *colors,int ncolors,Bool kludge,FILE *in_file){
+     if(!colors||(ncolors<=0))
+ 	return False;
+ #if defined(__alpha)
+     if(kludge){
+ 	XWDColor *xwdcolors;
+ 	Bool	  okay;
+ 	if(!(xwdcolors = (XWDColor *)calloc(ncolors,sizeof(XWDColor))))
+ 	    return False;
+ 	if(okay = Read((char *)xwdcolors,sizeof(XWDColor),ncolors,in_file)){
+ 	    int	i;
+ 	    for(i = 0; i < ncolors; i++){
+ 		colors[i].pixel = (unsigned long)  xwdcolors[i].pixel;
+ 		colors[i].red   = (unsigned short) xwdcolors[i].red;
+ 		colors[i].green = (unsigned short) xwdcolors[i].green;
+ 		colors[i].blue  = (unsigned short) xwdcolors[i].blue;
+ 		colors[i].flags = (char)	       xwdcolors[i].flags;
+ 		colors[i].pad   = (char)  	       xwdcolors[i].pad;
+ 	    } 
+ 	} free(xwdcolors); return okay;
+     }
+ #endif
+     return Read((char *) colors, sizeof(XColor), ncolors, in_file);
+ }
  
+ 
  main(argc, argv)
      int argc;
      char **argv;
***************
*** 81,86 ****
--- 115,121 ----
      char *win_name;
      Bool inverse = False, rawbits = False, newmap = False;
      Bool onclick = True;
+     Bool kludge  = False;
      int plane = -1;
      char *std = NULL;
      char *vis = NULL;
***************
*** 150,155 ****
--- 185,194 ----
  	    onclick = False;
  	    continue;
  	}
+ 	if (strcmp(argv[i], "-kludge") == 0){
+ 	    kludge = True;
+ 	    continue;
+ 	}
  	if (strcmp(argv[i], "-plane") == 0) {
  	    if (++i >= argc) usage();
  	    plane = atoi(argv[i]);
***************
*** 258,265 ****
  	colors = (XColor *)malloc((unsigned) ncolors * sizeof(XColor));
  	if (!colors)
  	    Error("Can't malloc color table");
! 	if(!Read((char *) colors, sizeof(XColor), ncolors, in_file))
! 	  Error("Unable to read color map from dump file.");
  	if (*(char *) &swaptest) {
  	    for (i = 0; i < ncolors; i++) {
  		_swaplong((char *) &colors[i].pixel, sizeof(long));
--- 297,304 ----
  	colors = (XColor *)malloc((unsigned) ncolors * sizeof(XColor));
  	if (!colors)
  	    Error("Can't malloc color table");
! 	if(!Read_XColors(colors,ncolors,kludge,in_file))
! 	    Error("Unable to read color map from dump file.");
  	if (*(char *) &swaptest) {
  	    for (i = 0; i < ncolors; i++) {
  		_swaplong((char *) &colors[i].pixel, sizeof(long));
diff -c /afs/ir/src/X11R5/mit/clients/xwud/xwud.man xwud/xwud.man
*** /afs/ir/src/X11R5/mit/clients/xwud/xwud.man	Sat Jul 27 15:42:02 1991
--- xwud/xwud.man	Wed Apr  6 10:02:02 1994
***************
*** 4,10 ****
  .SH SYNOPSIS
  .B "xwud"
  [-in \fIfile\fP] [-noclick] [-geometry \fIgeom\fP] [-display \fIdisplay\fP]
! [-new] [-std <maptype>] [-raw] [-vis <vis-type-or-id>]
  [-help] [-rv] [-plane \fInumber\fP] [-fg \fIcolor\fP] [-bg \fIcolor\fP]
  .SH DESCRIPTION
  .PP
--- 4,10 ----
  .SH SYNOPSIS
  .B "xwud"
  [-in \fIfile\fP] [-noclick] [-geometry \fIgeom\fP] [-display \fIdisplay\fP]
! [-kludge] [-new] [-std <maptype>] [-raw] [-vis <vis-type-or-id>]
  [-help] [-rv] [-plane \fInumber\fP] [-fg \fIcolor\fP] [-bg \fIcolor\fP]
  .SH DESCRIPTION
  .PP
***************
*** 40,45 ****
--- 40,49 ----
  Print out a short description of the allowable options.
  .PP
  .TP 8
+ .B "-kludge"
+ see BUGS
+ .PP
+ .TP 8
  .B "-in \fIfile\fP"
  This option allows the user to explicitly specify the input 
  file on the command line.  If no input file is given, the standard input
***************
*** 113,118 ****
--- 117,129 ----
  X Window Dump File format definition file.
  .SH SEE ALSO
  xwd(1), xpr(1), xstdcmap(1), X(1)
+ .SH BUGS
+ The xwd format is intrinsically unportable, due to potential differences
+ in sizes of various data structures (XColor in particular on some 64 bit
+ machines).  The 
+ .B -kludge 
+ flag tries to force xwud to preserve compatibility with the most widely
+ used sizes.
  .SH COPYRIGHT
  Copyright 1988, Massachusetts Institute of Technology.
  .br
