diff options
author | rws <empty> | 1993-09-29 17:49:06 +0000 |
---|---|---|
committer | rws <empty> | 1993-09-29 17:49:06 +0000 |
commit | 1f090601ffadae24a6b87db7e57f2b079723caf3 (patch) | |
tree | 72245ff80a61bb775842838128426ef9bff7ae38 | |
parent | 0f28df5fa723a8215bddc3023bbe9a4599df32f4 (diff) |
make work right on cray
-rw-r--r-- | xc/programs/xwd/xwd.c | 24 | ||||
-rw-r--r-- | xc/programs/xwud/xwud.c | 22 |
2 files changed, 30 insertions, 16 deletions
diff --git a/xc/programs/xwd/xwd.c b/xc/programs/xwd/xwd.c index b2119075f..165e4430b 100644 --- a/xc/programs/xwd/xwd.c +++ b/xc/programs/xwd/xwd.c @@ -1,4 +1,4 @@ -/* $XConsortium: xwd.c,v 1.59 93/09/13 12:02:28 rws Exp $ */ +/* $XConsortium: xwd.c,v 1.60 93/09/20 17:45:56 hersh Exp $ */ /* Copyright 1987 Massachusetts Institute of Technology */ @@ -54,6 +54,7 @@ extern int errno; #include <X11/Xmu/WinUtil.h> typedef unsigned long Pixel; +#include "X11/XWDFile.h" #define FEEP_VOLUME 0 @@ -190,8 +191,6 @@ main(argc, argv) char *calloc(); -#include "X11/XWDFile.h" - Window_Dump(window, out) Window window; FILE *out; @@ -212,7 +211,7 @@ Window_Dump(window, out) int bw; Window dummywin; XWDFileHeader header; - + XWDColor xwdcolor; /* * Inform the user not to alter the screen. @@ -306,7 +305,7 @@ Window_Dump(window, out) * Calculate header size. */ if (debug) outl("xwd: Calculating header size.\n"); - header_size = sizeof(header) + win_name_size; + header_size = SIZEOF(XWDheader) + win_name_size; /* * Write out header information. @@ -346,7 +345,7 @@ Window_Dump(window, out) } } - if (fwrite((char *)&header, sizeof(header), 1, out) != 1 || + if (fwrite((char *)&header, SIZEOF(XWDheader), 1, out) != 1 || fwrite(win_name, win_name_size, 1, out) != 1) { perror("xwd"); exit(1); @@ -357,9 +356,16 @@ Window_Dump(window, out) */ if (debug) outl("xwd: Dumping %d colors.\n", ncolors); - if (fwrite((char *) colors, sizeof(XColor), ncolors, out) != ncolors) { - perror("xwd"); - exit(1); + for (i = 0; i < ncolors; i++) { + xwdcolor.pixel = colors[i].pixel; + xwdcolor.red = colors[i].red; + xwdcolor.green = colors[i].green; + xwdcolor.blue = colors[i].blue; + xwdcolor.flags = colors[i].flags; + if (fwrite((char *) &xwdcolor, SIZEOF(XWDColor), 1, out) != 1) { + perror("xwd"); + exit(1); + } } /* diff --git a/xc/programs/xwud/xwud.c b/xc/programs/xwud/xwud.c index 0b4469fc6..1ec3c8bf5 100644 --- a/xc/programs/xwud/xwud.c +++ b/xc/programs/xwud/xwud.c @@ -1,4 +1,4 @@ -/* $XConsortium: xwud.c,v 1.52 92/04/14 17:51:22 rws Exp $ */ +/* $XConsortium: xwud.c,v 1.53 93/09/13 12:02:48 rws Exp $ */ /* Copyright 1985, 1986, 1988 Massachusetts Institute of Technology */ /* @@ -102,6 +102,7 @@ main(argc, argv) GC gc; XGCValues gc_val; XWDFileHeader header; + XWDColor xwdcolor; FILE *in_file = stdin; char *map_name; Atom map_prop; @@ -205,24 +206,24 @@ main(argc, argv) /* * Read in header information. */ - if(!Read((char *)&header, sizeof(header), 1, in_file)) + if(!Read((char *)&header, SIZEOF(XWDheader), 1, in_file)) Error("Unable to read dump file header."); if (*(char *) &swaptest) - _swaplong((char *) &header, sizeof(header)); + _swaplong((char *) &header, SIZEOF(XWDheader)); /* check to see if the dump file is in the proper format */ if (header.file_version != XWD_FILE_VERSION) { fprintf(stderr,"xwud: XWD file format version mismatch."); Error("exiting."); } - if (header.header_size < sizeof(header)) { + if (header.header_size < SIZEOF(XWDheader)) { fprintf(stderr,"xwud: XWD header size is too small."); Error("exiting."); } /* alloc window name */ - win_name_size = (header.header_size - sizeof(header)); + win_name_size = (header.header_size - SIZEOF(XWDheader)); if((win_name = malloc((unsigned) win_name_size + 6)) == NULL) Error("Can't malloc window name storage."); strcpy(win_name, "xwud: "); @@ -257,8 +258,15 @@ main(argc, argv) 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."); + for (i = 0; i < ncolors; i++) { + if(!Read((char *) &xwdcolor, SIZEOF(XWDColor), 1, in_file)) + Error("Unable to read color map from dump file."); + colors[i].pixel = xwdcolor.pixel; + colors[i].red = xwdcolor.red; + colors[i].green = xwdcolor.green; + colors[i].blue = xwdcolor.blue; + colors[i].flags = xwdcolor.flags; + } if (*(char *) &swaptest) { for (i = 0; i < ncolors; i++) { _swaplong((char *) &colors[i].pixel, sizeof(long)); |