--- ray/src/util/xglaresrc.c 1992/03/19 09:38:14 2.3 +++ ray/src/util/xglaresrc.c 2003/11/10 16:52:24 2.7 @@ -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.7 2003/11/10 16:52:24 greg Exp $"; #endif - /* * Circle sources in a displayed image. * @@ -12,8 +9,7 @@ static char SCCSid[] = "$SunId$ LBL"; #include "standard.h" #include "view.h" -#include "resolu.h" -#include "vfork.h" +#include "paths.h" #include #include #include @@ -88,6 +84,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) { @@ -103,18 +100,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); @@ -123,7 +127,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 { @@ -134,7 +138,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 {