--- ray/src/px/ximage.c 1989/04/07 16:36:10 1.2 +++ ray/src/px/ximage.c 1989/05/23 10:46:32 1.7 @@ -137,9 +137,7 @@ char *argv[]; sprintf(errmsg, "can't open file \"%s\"", fname); quiterr(errmsg); } - } else - goto userr; - + } /* get header */ getheader(fin, headline); /* get picture dimensions */ @@ -170,7 +168,7 @@ userr: headline(s) /* get relevant info from header */ char *s; { - static char *altname[] = {"rview","rpict","VIEW=",NULL}; + static char *altname[] = {"rview","rpict",VIEWSTR,NULL}; register char **an; if (!strncmp(s, "EXPOSURE=", 9)) @@ -347,7 +345,7 @@ redraw(x, y, w, h) /* redraw section of window */ int x, y; int w, h; { - if (map_rcolors(ourras) == NULL) { + if (ourras->ncolors && map_rcolors(ourras) == NULL) { fprintf(stderr, "%s: cannot allocate colors\n", progname); return(-1); } @@ -419,10 +417,8 @@ XKeyEvent *ekey; if (avgbox(cval) == -1) return(-1); n = log(.5/bright(cval))/.69315 - scale; /* truncate */ - if (n == 0) { - XFeep(0); + if (n == 0) return(0); - } scale_rcolors(ourras, pow(2.0, (double)n)); scale += n; sprintf(buf, "%+d", scale); @@ -431,8 +427,9 @@ XKeyEvent *ekey; XFlush(); free_raster(ourras); getras(); - return(redraw(0, 0, width, height)); + /* fall through */ case CTRL(R): /* redraw */ + case CTRL(L): XClear(wind); return(redraw(0, 0, width, height)); case ' ': /* clear */