diff -c /afs/ir/src/X11R5/mit/clients/xwd/xwd.c xwd/xwd.c *** /afs/ir/src/X11R5/mit/clients/xwd/xwd.c Thu Jul 25 15:01:04 1991 --- xwd/xwd.c Wed Apr 6 09:55:26 1994 *************** *** 34,39 **** --- 34,44 ---- * abilities. (Xwd V7 has yet to be tested on a color machine, so * all color-related code is commented out until color support * becomes practical.) + * + * 4/5/94 Achille Hui, + * - patches for alpha to write out the XColor structures in a more + * portable manner. Notice the XWDColor structure is defined only + * in /usr/include/X11/XWDFile.h on an alpha running OSF/1. */ /*% *************** *** 93,98 **** --- 98,104 ---- Window target_win; FILE *out_file = stdout; Bool frame_only = False; + Bool kludge = False; INIT_NAME; *************** *** 110,115 **** --- 116,125 ---- debug = True; continue; } + if(!strcmp(argv[i],"-kludge")){ + kludge = True; + continue; + } if (!strcmp(argv[i], "-help")) usage(); if (!strcmp(argv[i], "-out")) { *************** *** 164,170 **** /* * Dump it! */ ! Window_Dump(target_win, out_file); fclose(out_file); } --- 174,180 ---- /* * Dump it! */ ! Window_Dump(target_win, kludge, out_file); fclose(out_file); } *************** *** 179,186 **** #include "X11/XWDFile.h" ! Window_Dump(window, out) Window window; FILE *out; { unsigned long swaptest = 1; --- 189,243 ---- #include "X11/XWDFile.h" ! #if defined(__alpha) ! XWDColor * ! XColor2XWDColor(colors,ncolors) ! XColor *colors; ! int ncolors; ! { ! XWDColor *xwdcolors; ! int i; ! if(!colors||(ncolors<=0)|| ! !(xwdcolors = (XWDColor *)calloc(ncolors,sizeof(XWDColor)))) ! return (XWDColor *)0; ! for(i = 0; i < ncolors; i++){ ! xwdcolors[i].pixel = (CARD32) colors[i].pixel; ! xwdcolors[i].red = (CARD16) colors[i].red; ! xwdcolors[i].green = (CARD16) colors[i].green; ! xwdcolors[i].blue = (CARD16) colors[i].blue; ! xwdcolors[i].flags = (CARD8) colors[i].flags; ! xwdcolors[i].pad = (CARD8) colors[i].pad; ! } return xwdcolors; ! } ! #endif ! ! int ! Write_XColors(colors,ncolors,kludge,out) ! XColor *colors; ! int ncolors; ! Bool kludge; ! FILE *out; ! { ! if(!colors || (ncolors <= 0) || !out) ! return -1; ! #if defined(__alpha) ! if(kludge){ ! int okay; ! XWDColor *xwdcolors; ! if(!(xwdcolors = XColor2XWDColor(colors,ncolors))) ! return -1; ! okay = fwrite((char *) xwdcolors, sizeof(XWDColor), ncolors, out); ! free(xwdcolors); ! return okay; ! } ! #endif ! return fwrite((char *) colors, sizeof(XColor), ncolors, out); ! } ! ! ! Window_Dump(window, kludge,out) Window window; + Bool kludge; FILE *out; { unsigned long swaptest = 1; *************** *** 341,347 **** */ if (debug) outl("xwd: Dumping %d colors.\n", ncolors); ! (void) fwrite((char *) colors, sizeof(XColor), ncolors, out); /* * Write out the buffer. --- 398,404 ---- */ if (debug) outl("xwd: Dumping %d colors.\n", ncolors); ! (void) Write_XColors(colors,ncolors,kludge,out); /* * Write out the buffer. *************** *** 383,389 **** fprintf (stderr, "usage: %s [-display host:dpy] [-debug] [-help] %s [-nobdrs] [-out ]", program_name, SELECT_USAGE); ! fprintf (stderr, " [-xy] [-add value] [-frame]\n"); exit(1); } --- 440,446 ---- fprintf (stderr, "usage: %s [-display host:dpy] [-debug] [-help] %s [-nobdrs] [-out ]", program_name, SELECT_USAGE); ! fprintf (stderr, " [-kludge] [-xy] [-add value] [-frame]\n"); exit(1); } *************** *** 400,408 **** if (errno != 0) { perror("xwd"); outl("\n"); ! } ! ! exit(1); } --- 457,463 ---- if (errno != 0) { perror("xwd"); outl("\n"); ! } exit(1); } diff -c /afs/ir/src/X11R5/mit/clients/xwd/xwd.man xwd/xwd.man *** /afs/ir/src/X11R5/mit/clients/xwd/xwd.man Sat Jul 27 15:41:24 1991 --- xwd/xwd.man Wed Apr 6 09:55:48 1994 *************** *** 3,11 **** xwd - dump an image of an X window .SH SYNOPSIS .B "xwd" ! [-debug] [-help] [-nobdrs] [-out \fIfile\fP] [-xy] [-frame] [-add \fIvalue\fP] ! [-root | -id \fIid\fP | -name \fIname\fP ] [-icmap] [-screen] ! [-display \fIdisplay\fP] .SH DESCRIPTION .PP .I Xwd --- 3,11 ---- xwd - dump an image of an X window .SH SYNOPSIS .B "xwd" ! [-debug] [-kludge] [-help] [-nobdrs] [-out \fIfile\fP] [-xy] [-frame] ! [-add \fIvalue\fP] [-root | -id \fIid\fP | -name \fIname\fP ] [-icmap] ! [-screen] [-display \fIdisplay\fP] .SH DESCRIPTION .PP .I Xwd *************** *** 28,33 **** --- 28,37 ---- Print out the `Usage:' command syntax summary. .PP .TP 8 + .B "-kludge" + see BUGS + .PP + .TP 8 .B "-nobdrs" This argument specifies that the window dump should not include the pixels that compose the X window border. This is useful in situations *************** *** 95,100 **** --- 99,111 ---- X Window Dump File format definition file. .SH SEE ALSO xwud(1), xpr(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 xwd to preserve compatibility with the most widely + used sizes. .SH COPYRIGHT Copyright 1988, Massachusetts Institute of Technology. .br