--- ray/src/px/x11image.c 1993/11/22 11:33:18 2.35 +++ ray/src/px/x11image.c 1994/09/20 15:48:15 2.38 @@ -113,7 +113,7 @@ char *progname; char errmsg[128]; -extern BYTE clrtab[256][3]; /* global color map */ +BYTE clrtab[256][3]; /* global color map */ extern long ftell(); @@ -276,7 +276,7 @@ char **argv; if (gamstr == NULL) /* get it from the X server */ gamstr = XGetDefault(thedisplay, "radiance", "gamma"); if (gamstr == NULL) /* get it from the environment */ - gamstr = getenv("GAMMA"); + gamstr = getenv("DISPLAY_GAMMA"); if (gamstr != NULL) gamcor = atof(gamstr); /* get best visual for default screen */ @@ -366,10 +366,9 @@ char *err; if (es = err != NULL) fprintf(stderr, "%s: %s: %s\n", progname, fname==NULL?"":fname, err); - if (parent > 0 & wind != 0) { - XDestroyWindow(thedisplay, wind); - XFlush(thedisplay); - } else if (parent < 0 & sigrecv == 0) + if (thedisplay != NULL) + XCloseDisplay(thedisplay); + if (parent < 0 & sigrecv == 0) kill(getppid(), SIGCONT); while (parent > 0 && wait(&cs) != -1) { /* wait for any children */ if (es == 0) @@ -1000,7 +999,8 @@ getmapped() /* get color-mapped data */ /* set gamma correction */ setcolrgam(gamcor); /* make histogram */ - new_histo(); + if (new_histo((long)xmax*ymax) == -1) + quiterr("cannot initialize histogram"); for (y = 0; y < ymax; y++) { if (getscan(y) < 0) break;