--- ray/src/util/xglaresrc.c 1991/11/12 17:19:29 2.1 +++ ray/src/util/xglaresrc.c 2003/11/11 16:24:06 2.8 @@ -1,9 +1,6 @@ -/* Copyright (c) 1991 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: xglaresrc.c,v 2.8 2003/11/11 16:24:06 greg Exp $"; #endif - /* * Circle sources in a displayed image. * @@ -12,15 +9,10 @@ static char SCCSid[] = "$SunId$ LBL"; #include "standard.h" #include "view.h" -#include "resolu.h" #include #include #include -#ifndef BSD -#define vfork fork -#endif - #define XIM "ximage" #define NSEG 30 /* number of segments per circle */ @@ -47,7 +39,6 @@ main(argc, argv) int argc; char *argv[]; { - extern double atof(); char *windowname = NULL; FILE *fp; @@ -92,6 +83,7 @@ char *pname, *wname; XWindowAttributes wa; XColor xc; XGCValues gcv; + register int i; /* get the viewing parameters */ if (viewfile(pname, &ourview, &pres) <= 0 || setview(&ourview) != NULL) { @@ -107,18 +99,25 @@ char *pname, *wname; exit(1); } /* find our window */ - if (wname == NULL) - wname = pname; - gwind = xfindwind(theDisplay, rwind, wname, 2); + if (wname == NULL) { + /* remove directory prefix from name */ + for (i = strlen(pname); i-- > 0; ) + if (pname[i] == '/') + break; + wname = pname+i+1; + i = 0; + } else + i = 1; + gwind = xfindwind(theDisplay, rwind, wname, 4); if (gwind == None) { - if (wname != pname) { + if (i) { fprintf(stderr, "%s: cannot find \"%s\" window\n", progname, wname); exit(2); } /* start ximage */ - if (vfork() == 0) { - execlp(XIM, XIM, pname, 0); + if (fork() == 0) { + execlp(XIM, XIM, "-c", "256", pname, 0); perror(XIM); fprintf(stderr, "%s: cannot start %s\n", progname, XIM); @@ -127,7 +126,7 @@ char *pname, *wname; } do sleep(8); - while ((gwind=xfindwind(theDisplay,rwind,pname,2)) == None); + while ((gwind=xfindwind(theDisplay,rwind,wname,4)) == None); } else XMapRaised(theDisplay, gwind); do { @@ -138,7 +137,7 @@ char *pname, *wname; fprintf(stderr, "%s: warning -- window seems to be the wrong size!\n", progname); - if (pres.or & YMAJOR) { + if (pres.rt & YMAJOR) { pres.xr = wa.width; pres.yr = wa.height; } else {