--- ray/src/util/xglaresrc.c 1991/12/19 14:56:36 2.2 +++ ray/src/util/xglaresrc.c 1993/04/29 12:58:20 2.5 @@ -13,14 +13,11 @@ static char SCCSid[] = "$SunId$ LBL"; #include "standard.h" #include "view.h" #include "resolu.h" +#include "vfork.h" #include #include #include -#ifndef BSD -#define vfork fork -#endif - #define XIM "ximage" #define NSEG 30 /* number of segments per circle */ @@ -91,6 +88,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) { @@ -106,18 +104,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); + execlp(XIM, XIM, "-c", "256", pname, 0); perror(XIM); fprintf(stderr, "%s: cannot start %s\n", progname, XIM); @@ -126,7 +131,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 {