--- ray/src/px/ximage.c 1991/12/23 23:20:06 2.3 +++ ray/src/px/ximage.c 2003/06/30 14:59:12 2.12 @@ -1,9 +1,6 @@ -/* Copyright (c) 1987 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: ximage.c,v 2.12 2003/06/30 14:59:12 schorsch Exp $"; #endif - /* * ximage.c - driver for X-windows * @@ -18,19 +15,15 @@ static char SCCSid[] = "$SunId$ LBL"; #include #include - +#include #include +#include #include "color.h" - #include "resolu.h" - #include "xraster.h" - #include "view.h" - #include "pic.h" - #include "random.h" #define controlshift(e) (((XButtonEvent *)(e))->detail & (ShiftMask|ControlMask)) @@ -86,21 +79,19 @@ char *progname; char errmsg[128]; -extern long ftell(); -extern char *malloc(), *calloc(); - -extern double pow(), log(); - - main(argc, argv) int argc; char *argv[]; { + extern char *getenv(); + char *gv; int headline(); int i; progname = argv[0]; + if ((gv = getenv("DISPLAY_GAMMA")) != NULL) + gamcor = atof(gv); for (i = 1; i < argc; i++) if (argv[i][0] == '-') @@ -167,11 +158,10 @@ userr: } +int headline(s) /* get relevant info from header */ char *s; { - static char *altname[] = {"rview","rpict",VIEWSTR,NULL}; - register char **an; char fmt[32]; if (isexpos(s)) @@ -179,13 +169,9 @@ char *s; else if (isformat(s)) { formatval(fmt, s); wrongformat = strcmp(fmt, COLRFMT); - } else - for (an = altname; *an != NULL; an++) - if (!strncmp(*an, s, strlen(*an))) { - if (sscanview(&ourview, s+strlen(*an)) > 0) - gotview++; - return; - } + } else if (isview(s) && sscanview(&ourview, s) > 0) + gotview++; + return(0); } @@ -254,6 +240,7 @@ char *err; } +void eputs(s) char *s; { @@ -261,6 +248,7 @@ char *s; } +void quit(code) int code; { @@ -574,8 +562,8 @@ getmono() /* get monochrome data */ cerr[x] = err + errp; } } - free((char *)inl); - free((char *)cerr); + free((void *)inl); + free((void *)cerr); } @@ -603,7 +591,7 @@ colormap cmap; xr->cdefs[xr->ncolors].pixel = *p; xr->pmap[*p] = xr->ncolors++; } - xr->cdefs = (Color *)realloc((char *)xr->cdefs, xr->ncolors*sizeof(Color)); + xr->cdefs = (Color *)realloc((void *)xr->cdefs, xr->ncolors*sizeof(Color)); if (xr->cdefs == NULL) return(0); return(1); @@ -647,7 +635,7 @@ int y; if (fseek(fin, scanpos[y], 0) == -1) quiterr("fseek error"); cury = y; - } else if (scanpos != NULL) + } else if (scanpos != NULL && scanpos[y] == -1) scanpos[y] = ftell(fin); if (freadcolrs(scanline, xmax, fin) < 0) @@ -680,7 +668,7 @@ picwriteline(y, l) /* add 8-bit scanline to image */ int y; pixel *l; { - bcopy((char *)l, (char *)ourras->data.bz+BZPixmapSize(xmax,y), BZPixmapSize(xmax,1)); + memcpy((void *)ourras->data.bz+BZPixmapSize(xmax,y), (void *)l, BZPixmapSize(xmax,1)); }